[jboss-cvs] JBoss Messaging SVN: r6721 - trunk/tests/src/org/jboss/messaging/tests/util.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri May 8 17:56:47 EDT 2009


Author: clebert.suconic at jboss.com
Date: 2009-05-08 17:56:46 -0400 (Fri, 08 May 2009)
New Revision: 6721

Modified:
   trunk/tests/src/org/jboss/messaging/tests/util/JournalExample.java
Log:
Changing the example
(I was talking to Kevin, and wrote a quick example...
 I have temporarily added the example here for future reference. However I need to find a better place for it.
 It could be a nice tool for debug customers files )

Modified: trunk/tests/src/org/jboss/messaging/tests/util/JournalExample.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/util/JournalExample.java	2009-05-08 21:52:21 UTC (rev 6720)
+++ trunk/tests/src/org/jboss/messaging/tests/util/JournalExample.java	2009-05-08 21:56:46 UTC (rev 6721)
@@ -6,6 +6,7 @@
 import org.jboss.messaging.core.journal.SequentialFileFactory;
 import org.jboss.messaging.core.journal.impl.AIOSequentialFileFactory;
 import org.jboss.messaging.core.journal.impl.JournalImpl;
+import org.jboss.messaging.utils.TimeAndCounterIDGenerator;
 
 /*
  * JBoss, Home of Professional Open Source
@@ -60,6 +61,7 @@
    
    public static void main(String arg[])
    {
+      TimeAndCounterIDGenerator idgenerator = new TimeAndCounterIDGenerator();
       try
       {
          SequentialFileFactory fileFactory = new AIOSequentialFileFactory("/tmp"); // any dir you want
@@ -90,10 +92,10 @@
 
          System.out.println("Adding Records:");
          
-         journalExample.appendAddRecord(System.currentTimeMillis(), (byte)1, new byte[] { 0, 1, 2} );
+         journalExample.appendAddRecord(idgenerator.generateID(), (byte)1, new byte[] { 0, 1, 2} );
          
-         long tx = System.currentTimeMillis() + 1; // some id generation system
-         journalExample.appendAddRecordTransactional(tx, System.currentTimeMillis() + 2, (byte)2, new byte[] { 0, 1, 2});
+         long tx = idgenerator.generateID(); // some id generation system
+         journalExample.appendAddRecordTransactional(tx, idgenerator.generateID(), (byte)2, new byte[] { 0, 1, 2});
          
          journalExample.appendCommitRecord(tx);
 




More information about the jboss-cvs-commits mailing list