|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.ha.framework.server.HAServiceImpl<E>
org.jboss.ha.framework.server.HASingletonImpl<E>
public class HASingletonImpl<E extends EventObject>
Base class for HA-singleton based services.
Nested Class Summary | |
---|---|
protected class |
HASingletonImpl.RpcHandler
|
Field Summary |
---|
Fields inherited from class org.jboss.ha.framework.server.HAServiceImpl |
---|
log |
Fields inherited from interface org.jboss.ha.framework.interfaces.HASingleton |
---|
HASINGLETON_STARTED_NOTIFICATION, HASINGLETON_STARTING_NOTIFICATION, HASINGLETON_STOPPED_NOTIFICATION, HASINGLETON_STOPPING_NOTIFICATION |
Constructor Summary | |
---|---|
HASingletonImpl(EventFactory<E> eventFactory)
|
|
HASingletonImpl(EventFactory<E> eventFactory,
EventFacility<E> eventHandler,
HASingletonLifecycle singletonLifecycle)
|
Method Summary | |
---|---|
protected List<ClusterNode> |
getElectionCandidates()
|
HASingletonElectionPolicy |
getElectionPolicy()
Gets the policy used to determine which cluster node will become the master when the service topology changes. |
boolean |
getRestartOnMerge()
Gets whether this singleton will stop and restart itself if it is the master and a cluster merge occurs. |
protected HAServiceRpcHandler<E> |
getRpcHandler()
|
protected boolean |
isDRMMasterReplica()
|
boolean |
isMasterNode()
True if this cluster node has the active mbean singleton, false otherwise |
protected void |
makeThisNodeMaster()
|
protected void |
partitionTopologyChanged(List<?> newReplicants,
int newViewId,
boolean merge)
When topology changes, a new master is elected based on the result of the isDRMMasterReplica() call. |
protected void |
registerDRMListener()
|
protected void |
restartMaster()
|
void |
setElectionPolicy(HASingletonElectionPolicy electionPolicy)
Sets the policy used to determine which cluster node will become the master when the service topology changes. |
void |
setRestartOnMerge(boolean restart)
Sets whether this singleton will stop and restart itself if it is the master and a cluster merge occurs. |
protected void |
startNewMaster()
|
void |
startSingleton()
Invoked when this mbean is elected to run the singleton service, or in other words when this node is elected for master. |
protected void |
stopIfMaster()
|
void |
stopOldMaster()
|
void |
stopSingleton()
Invoked when this mbean is elected to no longer run the singleton service, or in other words when this node is elected for slave. |
Methods inherited from class org.jboss.ha.framework.server.HAServiceImpl |
---|
addEventListener, callAsyncMethodOnPartition, callMethodOnPartition, create, destroy, getEventFacility, getEventFactory, getHAPartition, getHAServiceKey, getReplicant, getServiceHAName, handleEvent, isRegisterThreadContextClassLoader, notifyListeners, registerRPCHandler, removeEventListener, replicantsChanged, setHAPartition, setRegisterThreadContextClassLoader, setServiceHAName, start, stop, unregisterDRMListener, unregisterRPCHandler |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.jboss.ha.framework.interfaces.HAService |
---|
create, destroy, getServiceHAName, isRegisterThreadContextClassLoader, setHAPartition, setRegisterThreadContextClassLoader, setServiceHAName, start, stop |
Methods inherited from interface org.jboss.ha.framework.interfaces.HAServiceKeyProvider |
---|
getHAPartition, getHAServiceKey |
Methods inherited from interface org.jboss.ha.framework.interfaces.EventListener |
---|
handleEvent |
Constructor Detail |
---|
public HASingletonImpl(EventFactory<E> eventFactory, EventFacility<E> eventHandler, HASingletonLifecycle singletonLifecycle)
public HASingletonImpl(EventFactory<E> eventFactory)
Method Detail |
---|
public HASingletonElectionPolicy getElectionPolicy()
HASingleton
getElectionPolicy
in interface HASingleton<E extends EventObject>
null
.public void setElectionPolicy(HASingletonElectionPolicy electionPolicy)
HASingleton
setElectionPolicy
in interface HASingleton<E extends EventObject>
electionPolicy
- the policy. Can be null
.public boolean getRestartOnMerge()
HASingleton
getRestartOnMerge
in interface HASingleton<E extends EventObject>
true
if a restart will occur, false
otherwisepublic void setRestartOnMerge(boolean restart)
HASingleton
setRestartOnMerge
in interface HASingleton<E extends EventObject>
restart
- true
if a restart should occur,
false
otherwise. Default is
true
.public boolean isMasterNode()
HASingletonMBean
isMasterNode
in interface HASingletonMBean
protected void registerDRMListener() throws Exception
registerDRMListener
in class HAServiceImpl<E extends EventObject>
Exception
HAServiceImpl.registerDRMListener()
public void startSingleton()
HASingletonLifecycle
startSingleton
in interface HASingletonLifecycle
HASingletonLifecycle.startSingleton()
public void stopSingleton()
HASingletonLifecycle
stopSingleton
in interface HASingletonLifecycle
HASingletonLifecycle.stopSingleton()
protected void partitionTopologyChanged(List<?> newReplicants, int newViewId, boolean merge)
partitionTopologyChanged
in class HAServiceImpl<E extends EventObject>
HAServiceImpl.partitionTopologyChanged(java.util.List, int, boolean)
,
DistributedReplicantManager.isMasterReplica(String)
protected List<ClusterNode> getElectionCandidates()
public void stopOldMaster() throws Exception
stopOldMaster
in interface HASingletonRpcHandler<E extends EventObject>
Exception
org.jboss.ha.singleton.HASingleton.RpcHandler#stopOldMaster()
protected boolean isDRMMasterReplica()
protected void makeThisNodeMaster()
protected void startNewMaster()
protected void restartMaster()
protected void stopIfMaster()
protected HAServiceRpcHandler<E> getRpcHandler()
getRpcHandler
in class HAServiceImpl<E extends EventObject>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |