Package EDU.oswego.cs.dl.util.concurrent

Examples of EDU.oswego.cs.dl.util.concurrent.FIFOSemaphore.release()


               // log("passed barrier");
               lock=s.readLock();
               lock.attempt(TIMEOUT);
               log("1st read: value is " + value);
               assertEquals(10, value);
               sem.release(); // give t2 time to make the modification
               TestingUtil.sleepThread(100);

               sem.acquire(); // to read the uncommitted modification by t2
               log("2nd read: value is " + value + "; we should see t2's uncommitted change (20)");
               assertEquals(20, value); // we're seeing the modification by t2 before t2 committed (a.k.a. released the lock)
View Full Code Here


               TestingUtil.sleepThread(100);

               sem.acquire(); // to read the uncommitted modification by t2
               log("2nd read: value is " + value + "; we should see t2's uncommitted change (20)");
               assertEquals(20, value); // we're seeing the modification by t2 before t2 committed (a.k.a. released the lock)
               sem.release();
               TestingUtil.sleepThread(100);

               sem.acquire(); // to read the committed change by t2
               log("3rd read: value is still " + value + "; we should see t2's committed change");
               assertEquals(20, value);
View Full Code Here

               t1_ex=ex;
            }
            finally {
               if(lock != null)
                  lock.release();
               sem.release();
            }
         }
      };

View Full Code Here

               sem.acquire();
               lock=s.writeLock();
               lock.attempt(TIMEOUT);
               log("changing value from " + value + " to 20");
               value=20;
               sem.release(); // now t1 can read the uncommitted modification
               TestingUtil.sleepThread(100);

               sem.acquire(); // to release the lock
               log("committing the TX");
               lock.release();
View Full Code Here

               t2_ex=ex;
            }
            finally {
               if(lock != null)
                  lock.release();
               sem.release();
            }
         }
      };

      t1.start();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.