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

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

public abstract class AbstractClusterLockSupport
extends Object
implements org.jboss.ha.framework.interfaces.HAPartition.HAMembershipListener

Base class for cluster-wide lock implementations.

Version:
$Revision:$
Author:
Brian Stansberry

Nested Class Summary
static class AbstractClusterLockSupport.RpcTarget
          Object the HAPartition can invoke on.
 
Field Summary
protected  Logger log
           
static Class<?>[] RELEASE_REMOTE_LOCK_TYPES
           
static Class<?>[] REMOTE_LOCK_TYPES
           
 
Constructor Summary
AbstractClusterLockSupport(String serviceHAName, org.jboss.ha.framework.interfaces.HAPartition partition, LocalLockHandler handler)
           
 
Method Summary
protected abstract  ClusterLockState getClusterLockState(Serializable categoryName)
           
protected  ClusterLockState getClusterLockState(Serializable lockName, boolean create)
           
 List<org.jboss.ha.framework.interfaces.ClusterNode> getCurrentView()
           
 org.jboss.ha.framework.interfaces.ClusterNode getLocalClusterNode()
           
 LocalLockHandler getLocalHandler()
           
protected  RemoteLockResponse getLock(Serializable categoryName, ClusterLockState category, org.jboss.ha.framework.interfaces.ClusterNode caller, long timeout)
          Always call this with a lock on the Category.
 org.jboss.ha.framework.interfaces.HAPartition getPartition()
           
 String getPartitionName()
           
 String getServiceHAName()
           
protected abstract  RemoteLockResponse handleLockSuccess(ClusterLockState lockState, org.jboss.ha.framework.interfaces.ClusterNode caller)
           
 boolean lock(Serializable lockId, long timeout)
           
 void membershipChanged(Vector deadMembers, Vector newMembers, Vector allMembers)
           
protected  void recordLockHolder(ClusterLockState lockState, org.jboss.ha.framework.interfaces.ClusterNode caller)
           
protected  void removeLockState(ClusterLockState lockState)
           
 void start()
           
 void stop()
           
abstract  void unlock(Serializable lockId)
           
protected abstract  RemoteLockResponse yieldLock(ClusterLockState lockState, org.jboss.ha.framework.interfaces.ClusterNode caller, long timeout)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REMOTE_LOCK_TYPES

public static final Class<?>[] REMOTE_LOCK_TYPES

RELEASE_REMOTE_LOCK_TYPES

public static final Class<?>[] RELEASE_REMOTE_LOCK_TYPES

log

protected final Logger log
Constructor Detail

AbstractClusterLockSupport

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

getPartition

public org.jboss.ha.framework.interfaces.HAPartition getPartition()

getServiceHAName

public String getServiceHAName()

getLocalHandler

public LocalLockHandler getLocalHandler()

lock

public boolean lock(Serializable lockId,
                    long timeout)

unlock

public abstract void unlock(Serializable lockId)

getPartitionName

public String getPartitionName()

getLocalClusterNode

public org.jboss.ha.framework.interfaces.ClusterNode getLocalClusterNode()

getCurrentView

public List<org.jboss.ha.framework.interfaces.ClusterNode> getCurrentView()

start

public void start()
           throws Exception
Throws:
Exception

stop

public void stop()
          throws Exception
Throws:
Exception

membershipChanged

public void membershipChanged(Vector deadMembers,
                              Vector newMembers,
                              Vector allMembers)
Specified by:
membershipChanged in interface org.jboss.ha.framework.interfaces.HAPartition.HAMembershipListener

handleLockSuccess

protected abstract RemoteLockResponse handleLockSuccess(ClusterLockState lockState,
                                                        org.jboss.ha.framework.interfaces.ClusterNode caller)

getClusterLockState

protected abstract ClusterLockState getClusterLockState(Serializable categoryName)

yieldLock

protected abstract RemoteLockResponse yieldLock(ClusterLockState lockState,
                                                org.jboss.ha.framework.interfaces.ClusterNode caller,
                                                long timeout)

recordLockHolder

protected void recordLockHolder(ClusterLockState lockState,
                                org.jboss.ha.framework.interfaces.ClusterNode caller)

getClusterLockState

protected ClusterLockState getClusterLockState(Serializable lockName,
                                               boolean create)

removeLockState

protected void removeLockState(ClusterLockState lockState)

getLock

protected RemoteLockResponse getLock(Serializable categoryName,
                                     ClusterLockState category,
                                     org.jboss.ha.framework.interfaces.ClusterNode caller,
                                     long timeout)
Always call this with a lock on the Category.



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