org.jboss.ha.framework.interfaces
Interface HASingleton<E extends EventObject>

All Superinterfaces:
EventListener, HAService<E>, HAServiceKeyProvider, HASingletonLifecycle, HASingletonMBean
All Known Implementing Classes:
HASingletonImpl

public interface HASingleton<E extends EventObject>
extends HAService<E>, HASingletonLifecycle, HASingletonMBean

Basic interface for HA-Singleton services.

Author:
Paul Ferraro

Field Summary
static String HASINGLETON_STARTED_NOTIFICATION
           
static String HASINGLETON_STARTING_NOTIFICATION
          Notifications emitted locally by an HASingleton to indicate state transitions
static String HASINGLETON_STOPPED_NOTIFICATION
           
static String HASINGLETON_STOPPING_NOTIFICATION
           
 
Method Summary
 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.
 void setElectionPolicy(HASingletonElectionPolicy policy)
          Sets the policy used to determine which cluster node will become the master when the service topology changes.
 void setRestartOnMerge(boolean restartOnMerge)
          Sets whether this singleton will stop and restart itself if it is the master and a cluster merge occurs.
 
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
 
Methods inherited from interface org.jboss.ha.framework.interfaces.HASingletonLifecycle
startSingleton, stopSingleton
 
Methods inherited from interface org.jboss.ha.framework.interfaces.HASingletonMBean
isMasterNode
 

Field Detail

HASINGLETON_STARTING_NOTIFICATION

static final String HASINGLETON_STARTING_NOTIFICATION
Notifications emitted locally by an HASingleton to indicate state transitions

See Also:
Constant Field Values

HASINGLETON_STARTED_NOTIFICATION

static final String HASINGLETON_STARTED_NOTIFICATION
See Also:
Constant Field Values

HASINGLETON_STOPPING_NOTIFICATION

static final String HASINGLETON_STOPPING_NOTIFICATION
See Also:
Constant Field Values

HASINGLETON_STOPPED_NOTIFICATION

static final String HASINGLETON_STOPPED_NOTIFICATION
See Also:
Constant Field Values
Method Detail

setElectionPolicy

void setElectionPolicy(HASingletonElectionPolicy policy)
Sets the policy used to determine which cluster node will become the master when the service topology changes. Injection of common attributes into the election policy should be done during createService() method call.

Parameters:
policy - the policy. Can be null.

getElectionPolicy

HASingletonElectionPolicy getElectionPolicy()
Gets the policy used to determine which cluster node will become the master when the service topology changes.

Returns:
the policy. Can be null.

getRestartOnMerge

boolean getRestartOnMerge()
Gets whether this singleton will stop and restart itself if it is the master and a cluster merge occurs.

A restart allows the service to reset any state that may have gotten out-of-sync with the rest of the cluster while the just-merged split was in effect.

Returns:
true if a restart will occur, false otherwise

setRestartOnMerge

void setRestartOnMerge(boolean restartOnMerge)
Sets whether this singleton will stop and restart itself if it is the master and a cluster merge occurs.

A restart allows the service to reset any state that may have gotten out-of-sync with the rest of the cluster while the just-merged split was in effect.

Parameters:
restartOnMerge - true if a restart should occur, false otherwise. Default is true.


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