[jboss-cvs] JBossAS SVN: r106463 - projects/cluster/ha-server-cache-spi/branches/Session_Ownership/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jul 6 14:39:15 EDT 2010


Author: bstansberry at jboss.com
Date: 2010-07-06 14:39:15 -0400 (Tue, 06 Jul 2010)
New Revision: 106463

Modified:
   projects/cluster/ha-server-cache-spi/branches/Session_Ownership/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/DistributedCacheManager.java
Log:
[JBCLUSTER-260] Add support for acquiring session ownership and using same to detect failover

Modified: projects/cluster/ha-server-cache-spi/branches/Session_Ownership/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/DistributedCacheManager.java
===================================================================
--- projects/cluster/ha-server-cache-spi/branches/Session_Ownership/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/DistributedCacheManager.java	2010-07-06 18:38:32 UTC (rev 106462)
+++ projects/cluster/ha-server-cache-spi/branches/Session_Ownership/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/spi/DistributedCacheManager.java	2010-07-06 18:39:15 UTC (rev 106463)
@@ -25,14 +25,37 @@
 import java.util.Map;
 import java.util.Set;
 
+import org.jboss.ha.framework.server.lock.TimeoutException;
+
 /**
  * SPI implemented by the distributed caching layer.
  * 
  * @author Brian Stansberry
- * @version $Revision: $
+ * @version $Revision$
  */
 public interface DistributedCacheManager<T extends OutgoingDistributableSessionData>
 {
+   /** Result of a {@link #acquireSessionOwnership(String, boolean) lock call}*/
+   public static enum LockResult 
+   { 
+      /** Indicates the lock was acquired after requesting it from the cluster */
+      ACQUIRED_FROM_CLUSTER, 
+      /** Indicates this node already held the lock */
+      ALREADY_HELD, 
+      /** 
+       * Indicates the 'newLock' param passed to 
+       * {@link #lock(String, boolean)}
+       * was <code>true</code> and the local node in fact was unaware of the
+       * lock. If in fact the local node was already aware of the lock (which
+       * would generally indicate a flaw in the application using this class)
+       * NEW_LOCK will not be returned; rather one of the other enum values
+       * will be returned.
+       */
+      NEW_LOCK,
+      /** Indicates {@link #getSupportsSessionOwnership()} will return <code>false</code>*/
+      UNSUPPORTED
+   }
+   
    /**
     * Starts the distributed caching layer.
     */
@@ -233,5 +256,11 @@
     *                                       would return <code>false</code>
     */
    Map<String, Object> getAttributes(String realId);
-
+   
+   boolean getSupportsSessionOwnership();
+   
+   LockResult acquireSessionOwnership(String realId, boolean newLock) throws TimeoutException, InterruptedException;
+   
+   void relinquishSessionOwnership(String realId, boolean remove);
+   void setForceSynchronous(boolean forceSynchronous);
 }
\ No newline at end of file



More information about the jboss-cvs-commits mailing list