public class DistributedStateManager<Z,D extends Database<Z>> extends Object implements StateManager, StateCommandContext<Z,D>, MembershipListener, Stateful
CLEAR_LOCAL_STATE
Constructor and Description |
---|
DistributedStateManager(DatabaseCluster<Z,D> cluster,
CommandDispatcherFactory dispatcherFactory) |
Modifier and Type | Method and Description |
---|---|
void |
activated(DatabaseEvent event)
Triggered after database is successfully activated.
|
void |
added(Member member)
Indicates that the specified member was added to the group.
|
void |
afterInvocation(InvocationEvent event) |
void |
afterInvoker(InvokerEvent event) |
void |
beforeInvocation(InvocationEvent event) |
void |
beforeInvoker(InvokerEvent event) |
void |
deactivated(DatabaseEvent event)
Triggered after database is successfully deactivated.
|
Set<String> |
getActiveDatabases() |
DatabaseCluster<Z,D> |
getDatabaseCluster() |
StateManager |
getLocalStateManager() |
Map<InvocationEvent,Map<String,InvokerEvent>> |
getRemoteInvokers(Remote remote) |
boolean |
isEnabled() |
void |
readState(ObjectInput input)
Returns the state of this object.
|
Map<InvocationEvent,Map<String,InvokerEvent>> |
recover() |
void |
removed(Member member)
Indicates the the specified member was removed from the group.
|
void |
setActiveDatabases(Set<String> databases) |
void |
start()
Called upon database cluster start.
|
void |
stop()
Called when database cluster is stopped.
|
void |
writeState(ObjectOutput output)
Sets the state of this object.
|
public DistributedStateManager(DatabaseCluster<Z,D> cluster, CommandDispatcherFactory dispatcherFactory) throws Exception
Exception
public Set<String> getActiveDatabases()
getActiveDatabases
in interface StateManager
StateManager.getActiveDatabases()
public void setActiveDatabases(Set<String> databases)
setActiveDatabases
in interface StateManager
StateManager.setActiveDatabases(java.util.Set)
public void activated(DatabaseEvent event)
activated
in interface DatabaseClusterListener
event
- indicates the database that was activatedDatabaseClusterListener.activated(net.sf.hajdbc.state.DatabaseEvent)
public void deactivated(DatabaseEvent event)
deactivated
in interface DatabaseClusterListener
event
- indicates the database that was deactivatedDatabaseClusterListener.deactivated(net.sf.hajdbc.state.DatabaseEvent)
public void afterInvocation(InvocationEvent event)
afterInvocation
in interface DurabilityListener
DurabilityListener.afterInvocation(net.sf.hajdbc.durability.InvocationEvent)
public void afterInvoker(InvokerEvent event)
afterInvoker
in interface DurabilityListener
DurabilityListener.afterInvoker(net.sf.hajdbc.durability.InvokerEvent)
public void beforeInvocation(InvocationEvent event)
beforeInvocation
in interface DurabilityListener
DurabilityListener.beforeInvocation(net.sf.hajdbc.durability.InvocationEvent)
public void beforeInvoker(InvokerEvent event)
beforeInvoker
in interface DurabilityListener
DurabilityListener.beforeInvoker(net.sf.hajdbc.durability.InvokerEvent)
public void start() throws Exception
start
in interface Lifecycle
Exception
- if this service fails to start.Lifecycle.start()
public void stop()
stop
in interface Lifecycle
Lifecycle.stop()
public boolean isEnabled()
isEnabled
in interface StateManager
public DatabaseCluster<Z,D> getDatabaseCluster()
getDatabaseCluster
in interface StateCommandContext<Z,D extends Database<Z>>
StateCommandContext.getDatabaseCluster()
public StateManager getLocalStateManager()
getLocalStateManager
in interface StateCommandContext<Z,D extends Database<Z>>
StateCommandContext.getLocalStateManager()
public Map<InvocationEvent,Map<String,InvokerEvent>> getRemoteInvokers(Remote remote)
getRemoteInvokers
in interface StateCommandContext<Z,D extends Database<Z>>
StateCommandContext.getRemoteInvokers(net.sf.hajdbc.distributed.Remote)
public void readState(ObjectInput input) throws IOException
readState
in interface Stateful
IOException
Stateful.readState(java.io.ObjectInput)
public void writeState(ObjectOutput output) throws IOException
writeState
in interface Stateful
IOException
Stateful.writeState(java.io.ObjectOutput)
public void added(Member member)
added
in interface MembershipListener
member
- the added memberMembershipListener.added(net.sf.hajdbc.distributed.Member)
public void removed(Member member)
removed
in interface MembershipListener
member
- the removed memberMembershipListener.removed(net.sf.hajdbc.distributed.Member)
public Map<InvocationEvent,Map<String,InvokerEvent>> recover()
recover
in interface StateManager
StateManager.recover()
Copyright © 2004–2014 Paul Ferraro. All rights reserved.