ozeigermann    2004/06/03 07:04:31

  Modified:    transaction/src/test/org/apache/commons/transaction/memory
                        MapWrapperTest.java
  Log:
  Sync was still wrong  :(

  ... fixed again
  
  Revision  Changes    Path
  1.4       +16 -11    
jakarta-commons-sandbox/transaction/src/test/org/apache/commons/transaction/memory/MapWrapperTest.java
  
  Index: MapWrapperTest.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/transaction/src/test/org/apache/commons/transaction/memory/MapWrapperTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MapWrapperTest.java       3 Jun 2004 13:33:39 -0000       1.3
  +++ MapWrapperTest.java       3 Jun 2004 14:04:31 -0000       1.4
  @@ -109,19 +109,24 @@
           final TransactionalMapWrapper txMap1 =
               new TransactionalMapWrapper(map1);
   
  -        final RendezvousBarrier commitBarrier =
  -            new RendezvousBarrier("Commit", 2, BARRIER_TIMEOUT, sLogger);
  +        final RendezvousBarrier beforeCommitBarrier =
  +            new RendezvousBarrier("Before Commit", 2, BARRIER_TIMEOUT, sLogger);
  +
  +             final RendezvousBarrier afterCommitBarrier =
  +                     new RendezvousBarrier("After Commit", 2, BARRIER_TIMEOUT, 
sLogger);
   
           Thread thread1 = new Thread(new Runnable() {
               public void run() {
                   txMap1.startTransaction();
                   try {
  +                                     beforeCommitBarrier.meet();
                       txMap1.put("key1", "value2");
                       txMap1.commitTransaction();
  -                    commitBarrier.meet();
  +                                     afterCommitBarrier.call();
                   } catch (InterruptedException e) {
                        logger.log(Level.WARNING, "Thread interrupted", e);
  -                                     commitBarrier.reset();
  +                                     afterCommitBarrier.reset();
  +                                     beforeCommitBarrier.reset();
                   }
               }
           }, "Thread1");
  @@ -131,10 +136,10 @@
   
           txMap1.startTransaction();
                thread1.start();
  -
  -        // before commit of other thread
  -        report("value1", (String) txMap1.get("key1"));
  -        commitBarrier.meet();
  +             
  +             report("value1", (String) txMap1.get("key1"));
  +             beforeCommitBarrier.call();
  +             afterCommitBarrier.meet();
           // we have read committed as isolation level, that's why I will see the new 
value of the other thread now
                report("value2", (String) txMap1.get("key1"));
                
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to