|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jgroups.blocks.MessageDispatcher org.jgroups.blocks.RpcDispatcher org.jboss.ha.framework.server.HAPartitionImpl
This class is an abstraction class for a JGroups RPCDispatch and JChannel. It is a default implementation of HAPartition for the JGroups framework
Nested Class Summary |
Nested classes inherited from class org.jgroups.blocks.RpcDispatcher |
org.jgroups.blocks.RpcDispatcher.Marshaller |
Nested classes inherited from class org.jboss.ha.framework.interfaces.HAPartition |
HAPartition.AsynchHAMembershipExtendedListener, HAPartition.AsynchHAMembershipListener, HAPartition.HAMembershipExtendedListener, HAPartition.HAMembershipListener, HAPartition.HAPartitionStateTransfer |
Field Summary | |
protected ArrayList |
asynchListeners
The asynch HAMembershipListener and HAMembershipExtendedListeners |
protected Thread |
asynchNotifyThread
The Thread used to send membership change notifications asynchronously |
protected EDU.oswego.cs.dl.util.concurrent.LinkedQueue |
asynchViewChanges
The LinkedQueue |
protected org.jgroups.JChannel |
channel
The JGroups partition channel |
protected org.jboss.logging.Logger |
clusterLifeCycleLog
|
protected long |
currentViewId
The current cluster view id |
protected DistributedStateImpl |
dsManager
The cluster state manager |
Vector |
history
|
protected Vector |
jgmembers
|
protected Vector |
jgotherMembers
|
protected ArrayList |
listeners
The HAMembershipListener and HAMembershipExtendedListeners |
protected org.jgroups.stack.IpAddress |
localJGAddress
the local JG IP Address |
protected org.jboss.logging.Logger |
log
The cluster instance log category |
protected ClusterNode |
me
me as a ClusterNode |
protected Vector |
members
The current cluster partition members |
protected String |
nodeName
The cluster transport protocol address string |
protected Vector |
otherMembers
The partition members other than this node |
protected String |
partitionName
The JChannel name |
protected DistributedReplicantManagerImpl |
replicantManager
The cluster replicant manager |
protected HashMap |
rpcHandlers
|
protected javax.management.MBeanServer |
server
The JMX MBeanServer to use for registrations |
protected long |
state_transfer_timeout
Number of ms to wait for state |
protected HashMap |
stateHandlers
|
protected long |
timeout
The timeout for cluster RPC calls |
Fields inherited from class org.jgroups.blocks.RpcDispatcher |
marshaller, server_obj |
Fields inherited from class org.jgroups.blocks.MessageDispatcher |
adapter, concurrent_processing, corr, deadlock_detection, id, local_addr, membership_listener, msg_listener, prot_adapter, req_handler, transport_adapter |
Constructor Summary | |
HAPartitionImpl(String partitionName,
org.jgroups.JChannel channel,
boolean deadlock_detection)
|
|
HAPartitionImpl(String partitionName,
org.jgroups.JChannel channel,
boolean deadlock_detection,
javax.management.MBeanServer server)
|
Method Summary | |
protected void |
bind(String jndiName,
Object who,
Class classType,
Context ctx)
Helper method that binds the partition in the JNDI tree. |
void |
block()
|
void |
callAsynchMethodOnCluster(String objName,
String methodName,
Object[] args,
boolean excludeSelf)
Deprecated. Use callAsynchMethodOnCluster(String, String, Object[], Class[], boolean) instead |
void |
callAsynchMethodOnCluster(String objName,
String methodName,
Object[] args,
Class[] types,
boolean excludeSelf)
This function is an abstraction of RpcDispatcher for asynchronous messages |
ArrayList |
callMethodOnCluster(String objName,
String methodName,
Object[] args,
boolean excludeSelf)
Deprecated. Use callMethodOnCluster(String,String,Object[],Class[], boolean) instead |
ArrayList |
callMethodOnCluster(String objName,
String methodName,
Object[] args,
Class[] types,
boolean excludeSelf)
This function is an abstraction of RpcDispatcher. |
ArrayList |
callMethodOnCluster(String objName,
String methodName,
Object[] args,
Class[] types,
boolean excludeSelf,
long methodTimeout)
|
void |
closePartition()
|
ClusterNode[] |
getClusterNodes()
Return the member nodes that built the current view i.e. |
Vector |
getCurrentView()
Return the list of member nodes that built the current view i.e. |
long |
getCurrentViewId()
Each time the partition topology changes, a new view is computed. |
protected Vector |
getDeadMembers(Vector oldMembers,
Vector newMembers)
Helper method that returns a vector of dead members from two input vectors: new and old vectors of two views. |
DistributedReplicantManager |
getDistributedReplicantManager()
Accessor to the DRM that is linked to this partition. |
DistributedState |
getDistributedStateService()
Accessor the the DistributedState (DS) that is linked to this partition. |
long |
getMethodCallTimeout()
|
protected Vector |
getNewMembers(Vector oldMembers,
Vector allMembers)
Helper method that returns a vector of new members from two input vectors: new and old vectors of two views. |
String |
getNodeName()
Return the name of the current name in the current partition. |
String |
getPartitionName()
The name of the partition. |
byte[] |
getState()
|
long |
getStateTransferTimeout()
|
Object |
handle(org.jgroups.Message req)
Message contains MethodCall. |
void |
init()
|
boolean |
isCurrentNodeCoordinator()
|
void |
logHistory(String message)
|
protected void |
notifyListeners(ArrayList theListeners,
long viewID,
Vector allMembers,
Vector deadMembers,
Vector newMembers,
Vector originatingGroups)
|
static Object |
objectFromByteBuffer(byte[] buffer)
Creates an object from a byte buffer |
static byte[] |
objectToByteBuffer(Object obj)
Serializes an object into a byte buffer. |
void |
receive(org.jgroups.Message msg)
|
void |
registerMembershipListener(HAPartition.HAMembershipListener listener)
Subscribes to receive HAMembershipListener events. |
void |
registerRPCHandler(String objName,
Object subscriber)
The partition receives RPC calls from other nodes in the cluster and demultiplex them, according to a service name, to a particular service. |
void |
setMethodCallTimeout(long timeout)
|
void |
setState(byte[] obj)
|
void |
setStateTransferTimeout(long state_transfer_timeout)
|
void |
startPartition()
|
void |
subscribeToStateTransferEvents(String objectName,
HAPartition.HAPartitionStateTransfer subscriber)
Register a service that will participate in state transfer protocol and receive callbacks |
void |
suspect(org.jgroups.Address suspected_mbr)
|
protected Vector |
translateAddresses(Vector jgAddresses)
|
void |
unregisterMembershipListener(HAPartition.HAMembershipListener listener)
Unsubscribes from receiving HAMembershipListener events. |
void |
unregisterRPCHandler(String objName,
Object subscriber)
Unregister the service from the partition |
void |
unsubscribeFromStateTransferEvents(String objectName,
HAPartition.HAPartitionStateTransfer subscriber)
Unregister a service from state transfer callbacks. |
protected void |
verifyNodeIsUnique(Vector javaGroupIpAddresses)
|
void |
viewAccepted(org.jgroups.View newView)
Notification of a cluster view change. |
Methods inherited from class org.jgroups.blocks.RpcDispatcher |
callRemoteMethod, callRemoteMethod, callRemoteMethod, callRemoteMethods, callRemoteMethods, callRemoteMethods, castMessage, channelClosed, channelConnected, channelDisconnected, channelReconnected, channelShunned, getMarshaller, getName, getServerObject, sendMessage, setMarshaller |
Methods inherited from class org.jgroups.blocks.MessageDispatcher |
castMessage, done, send, setConcurrentProcessing, setDeadlockDetection, setMembershipListener, setMessageListener, setRequestHandler, start, stop |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected HashMap rpcHandlers
protected HashMap stateHandlers
protected ArrayList listeners
protected ArrayList asynchListeners
protected EDU.oswego.cs.dl.util.concurrent.LinkedQueue asynchViewChanges
protected Thread asynchNotifyThread
protected Vector members
protected Vector jgmembers
public Vector history
protected Vector otherMembers
protected Vector jgotherMembers
protected String partitionName
protected org.jgroups.stack.IpAddress localJGAddress
protected String nodeName
protected ClusterNode me
protected long timeout
protected org.jgroups.JChannel channel
protected DistributedReplicantManagerImpl replicantManager
protected DistributedStateImpl dsManager
protected org.jboss.logging.Logger log
protected org.jboss.logging.Logger clusterLifeCycleLog
protected long currentViewId
protected javax.management.MBeanServer server
protected long state_transfer_timeout
Constructor Detail |
public HAPartitionImpl(String partitionName, org.jgroups.JChannel channel, boolean deadlock_detection, javax.management.MBeanServer server) throws Exception
public HAPartitionImpl(String partitionName, org.jgroups.JChannel channel, boolean deadlock_detection) throws Exception
Method Detail |
public static Object objectFromByteBuffer(byte[] buffer) throws Exception
Exception
public static byte[] objectToByteBuffer(Object obj) throws Exception
Exception
public long getStateTransferTimeout()
public void setStateTransferTimeout(long state_transfer_timeout)
public long getMethodCallTimeout()
public void setMethodCallTimeout(long timeout)
public void init() throws Exception
Exception
public void startPartition() throws Exception
Exception
public void closePartition() throws Exception
Exception
public byte[] getState()
getState
in interface org.jgroups.MessageListener
public void setState(byte[] obj)
setState
in interface org.jgroups.MessageListener
public void receive(org.jgroups.Message msg)
receive
in interface org.jgroups.MessageListener
public void suspect(org.jgroups.Address suspected_mbr)
suspect
in interface org.jgroups.MembershipListener
public void block()
block
in interface org.jgroups.MembershipListener
public void viewAccepted(org.jgroups.View newView)
viewAccepted
in interface org.jgroups.MembershipListener
newView
- public String getNodeName()
HAPartition
getNodeName
in interface HAPartition
public String getPartitionName()
HAPartition
getPartitionName
in interface HAPartition
public DistributedReplicantManager getDistributedReplicantManager()
HAPartition
getDistributedReplicantManager
in interface HAPartition
public DistributedState getDistributedStateService()
HAPartition
getDistributedStateService
in interface HAPartition
public long getCurrentViewId()
HAPartition
getCurrentViewId
in interface HAPartition
public Vector getCurrentView()
HAPartition
getCurrentView
in interface HAPartition
public ClusterNode[] getClusterNodes()
HAPartition
getClusterNodes
in interface HAPartition
public boolean isCurrentNodeCoordinator()
public void registerRPCHandler(String objName, Object subscriber)
HAPartition
registerRPCHandler
in interface HAPartition
objName
- Name of the subscribing service (demultiplexing key)subscriber
- object to be called when receiving a RPC for its key.public void unregisterRPCHandler(String objName, Object subscriber)
HAPartition
unregisterRPCHandler
in interface HAPartition
objName
- Name of the service key (on which the demultiplexing occurs)subscriber
- The target object that unsubscribespublic ArrayList callMethodOnCluster(String objName, String methodName, Object[] args, boolean excludeSelf) throws Exception
callMethodOnCluster(String,String,Object[],Class[], boolean)
instead
callMethodOnCluster
in interface HAPartition
objName
- methodName
- args
- excludeSelf
-
Exception
public ArrayList callMethodOnCluster(String objName, String methodName, Object[] args, Class[] types, boolean excludeSelf) throws Exception
callMethodOnCluster
in interface HAPartition
objName
- Name of the target service name on which calls are de-multiplexedmethodName
- name of the Java method to be called on remote servicesargs
- array of Java Object representing the set of parameters to be
given to the remote methodtypes
- The types of the parametersexcludeSelf
- indicates if the RPC must also be made on the current
node of the partition or only on remote nodes
Exception
- Throws if a communication exception occurspublic ArrayList callMethodOnCluster(String objName, String methodName, Object[] args, Class[] types, boolean excludeSelf, long methodTimeout) throws Exception
Exception
public void callAsynchMethodOnCluster(String objName, String methodName, Object[] args, boolean excludeSelf) throws Exception
callAsynchMethodOnCluster(String, String, Object[], Class[], boolean)
instead
callAsynchMethodOnCluster
in interface HAPartition
objName
- methodName
- args
- excludeSelf
-
Exception
public void callAsynchMethodOnCluster(String objName, String methodName, Object[] args, Class[] types, boolean excludeSelf) throws Exception
callAsynchMethodOnCluster
in interface HAPartition
objName
- Name of the target service name on which calls are de-multiplexedmethodName
- name of the Java method to be called on remote servicesargs
- array of Java Object representing the set of parameters to be
given to the remote methodtypes
- The types of the parametersexcludeSelf
- indicates if the RPC must also be made on the current
node of the partition or only on remote nodes
Exception
- Throws if a communication exception occurspublic void subscribeToStateTransferEvents(String objectName, HAPartition.HAPartitionStateTransfer subscriber)
HAPartition
subscribeToStateTransferEvents
in interface HAPartition
objectName
- Name of the service that subscribes for state stransfer events. This name must be identical for all identical services in the cluster.subscriber
- Object implementing HAPartition.HAPartitionStateTransfer
and providing or receiving state transfer callbackspublic void unsubscribeFromStateTransferEvents(String objectName, HAPartition.HAPartitionStateTransfer subscriber)
HAPartition
unsubscribeFromStateTransferEvents
in interface HAPartition
objectName
- Name of the service that participates in the state transfer protocolsubscriber
- Service implementing the state transfer callback methodspublic void registerMembershipListener(HAPartition.HAMembershipListener listener)
HAPartition
HAPartition.HAMembershipListener
events.
registerMembershipListener
in interface HAPartition
listener
- The membership listener objectpublic void unregisterMembershipListener(HAPartition.HAMembershipListener listener)
HAPartition
HAPartition.HAMembershipListener
events.
unregisterMembershipListener
in interface HAPartition
listener
- The listener wishing to unsubscribepublic Object handle(org.jgroups.Message req)
handle
in interface org.jgroups.blocks.RequestHandler
req
- The org.jgroups. representation of the method invocation
protected void verifyNodeIsUnique(Vector javaGroupIpAddresses) throws Exception
Exception
protected void bind(String jndiName, Object who, Class classType, Context ctx) throws Exception
jndiName
- Name under which the object must be boundwho
- Object to bind in JNDIclassType
- Class type under which should appear the bound objectctx
- Naming context under which we bind the object
Exception
- Thrown if a naming exception occurs during bindingprotected Vector getDeadMembers(Vector oldMembers, Vector newMembers)
oldMembers
- Vector of old membersnewMembers
- Vector of new members
protected Vector getNewMembers(Vector oldMembers, Vector allMembers)
oldMembers
- Vector of old membersallMembers
- Vector of new members
protected void notifyListeners(ArrayList theListeners, long viewID, Vector allMembers, Vector deadMembers, Vector newMembers, Vector originatingGroups)
protected Vector translateAddresses(Vector jgAddresses)
public void logHistory(String message)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |