[infinispan-commits] Infinispan SVN: r701 - trunk/core/src/main/java/org/infinispan/util/concurrent.

infinispan-commits at lists.jboss.org infinispan-commits at lists.jboss.org
Mon Aug 17 09:54:13 EDT 2009


Author: manik.surtani at jboss.com
Date: 2009-08-17 09:54:13 -0400 (Mon, 17 Aug 2009)
New Revision: 701

Removed:
   trunk/core/src/main/java/org/infinispan/util/concurrent/WatchableValue.java
Log:
Removed unused class and test

Deleted: trunk/core/src/main/java/org/infinispan/util/concurrent/WatchableValue.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/util/concurrent/WatchableValue.java	2009-08-17 13:47:40 UTC (rev 700)
+++ trunk/core/src/main/java/org/infinispan/util/concurrent/WatchableValue.java	2009-08-17 13:54:13 UTC (rev 701)
@@ -1,60 +0,0 @@
-package org.infinispan.util.concurrent;
-
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.AbstractQueuedSynchronizer;
-
-/**
- * Allows threads to watch a variable and be notified when the state of the variable reaches a specific value.
- * <p/>
- * E.g.,
- * <p/>
- * ValueNotifier v = new ValueNotifier(0);
- * <p/>
- * Thread1:
- * <p/>
- * v.setValue(10);
- * <p/>
- * Thread2:
- * <p/>
- * v.awaitValue(5); // will block until another thread sets the value to 5
- *
- * @author Manik Surtani
- * @since 4.0
- */
-public class WatchableValue extends AbstractQueuedSynchronizer {
-   private static final long serialVersionUID = 1744280161777661090l;
-
-   public WatchableValue(int initValue) {
-      setState(initValue);
-   }
-
-   @Override
-   public final int tryAcquireShared(int value) {
-      // return 1 if we allow the requestor to proceed, -1 if we want the requestor to block.
-      return getState() == value ? 1 : -1;
-   }
-
-   @Override
-   public final boolean tryReleaseShared(int state) {
-      // used as a mechanism to set the state of the Sync.
-      setState(state);
-      return true;
-   }
-
-   public final void setValue(int value) {
-      // do not use setState() directly since this won't notify parked threads.
-      releaseShared(value);
-   }
-
-   public final void awaitValue(int value) throws InterruptedException {
-      acquireSharedInterruptibly(value);
-   }
-
-   public final boolean awaitValue(int value, long time, TimeUnit unit) throws InterruptedException {
-      return tryAcquireSharedNanos(value, unit.toNanos(time));
-   }
-
-   public int getValue() {
-      return getState();
-   }
-}



More information about the infinispan-commits mailing list