org.jboss.ha.framework.server.lock
Class NonGloballyExclusiveClusterLockSupport

java.lang.Object
  extended by org.jboss.ha.framework.server.lock.AbstractClusterLockSupport
      extended by org.jboss.ha.framework.server.lock.NonGloballyExclusiveClusterLockSupport
All Implemented Interfaces:
org.jboss.ha.framework.interfaces.HAPartition.HAMembershipListener

public class NonGloballyExclusiveClusterLockSupport
extends AbstractClusterLockSupport

Support class for cluster locking scenarios where threads can hold a local lock on a category but not a cluster-wide lock. Multiple nodes can simultaneously hold a local lock on a category, but none can hold a local lock on a category if the cluster-wide lock is held. Cluster-wide lock cannot be acquired while any node holds a local lock.

NOTE: This class does not support "upgrades", i.e. scenarios where a thread acquires the local lock and then while holding the local lock attempts to acquire the cluster-wide lock.

Author:
Brian Stansberry

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jboss.ha.framework.server.lock.AbstractClusterLockSupport
AbstractClusterLockSupport.RpcTarget
 
Field Summary
 
Fields inherited from class org.jboss.ha.framework.server.lock.AbstractClusterLockSupport
log, RELEASE_REMOTE_LOCK_TYPES, REMOTE_LOCK_TYPES
 
Constructor Summary
NonGloballyExclusiveClusterLockSupport(String serviceHAName, org.jboss.ha.framework.interfaces.HAPartition partition, LocalLockHandler handler)
           
 
Method Summary
protected  ClusterLockState getClusterLockState(Serializable categoryName)
           
protected  RemoteLockResponse handleLockSuccess(ClusterLockState lockState, org.jboss.ha.framework.interfaces.ClusterNode caller)
           
 void unlock(Serializable lockId)
           
protected  RemoteLockResponse yieldLock(ClusterLockState lockState, org.jboss.ha.framework.interfaces.ClusterNode caller, long timeout)
           
 
Methods inherited from class org.jboss.ha.framework.server.lock.AbstractClusterLockSupport
getClusterLockState, getCurrentView, getLocalClusterNode, getLocalHandler, getLock, getPartition, getPartitionName, getServiceHAName, lock, membershipChanged, recordLockHolder, removeLockState, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NonGloballyExclusiveClusterLockSupport

public NonGloballyExclusiveClusterLockSupport(String serviceHAName,
                                              org.jboss.ha.framework.interfaces.HAPartition partition,
                                              LocalLockHandler handler)
Method Detail

unlock

public void unlock(Serializable lockId)
Specified by:
unlock in class AbstractClusterLockSupport

getClusterLockState

protected ClusterLockState getClusterLockState(Serializable categoryName)
Specified by:
getClusterLockState in class AbstractClusterLockSupport

yieldLock

protected RemoteLockResponse yieldLock(ClusterLockState lockState,
                                       org.jboss.ha.framework.interfaces.ClusterNode caller,
                                       long timeout)
Specified by:
yieldLock in class AbstractClusterLockSupport

handleLockSuccess

protected RemoteLockResponse handleLockSuccess(ClusterLockState lockState,
                                               org.jboss.ha.framework.interfaces.ClusterNode caller)
Specified by:
handleLockSuccess in class AbstractClusterLockSupport


Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.