C
- the execution context typepublic class JGroupsCommandDispatcher<C> extends Object implements org.jgroups.blocks.RequestHandler, CommandDispatcher<C>, org.jgroups.MembershipListener, org.jgroups.MessageListener
MessageDispatcher
Constructor and Description |
---|
JGroupsCommandDispatcher(String id,
org.jgroups.Channel channel,
long timeout,
C context,
Stateful stateful,
MembershipListener membershipListener)
Constructs a new ChannelCommandDispatcher.
|
Modifier and Type | Method and Description |
---|---|
void |
block() |
<R> Map<Member,R> |
executeAll(Command<R,C> command)
Execute the specified command on the group coordinator.
|
<R> R |
executeCoordinator(Command<R,C> command)
Execute the specified command on the coordinator.
|
Member |
getCoordinator()
Returns the group coordinator.
|
Member |
getLocal()
Returns the local member.
|
void |
getState(OutputStream output) |
Object |
handle(org.jgroups.Message message) |
boolean |
isCoordinator()
Indicates whether or not the local member is the group coordinator.
|
void |
receive(org.jgroups.Message message) |
void |
setState(InputStream input) |
void |
start()
Called upon database cluster start.
|
void |
stop()
Called when database cluster is stopped.
|
void |
suspect(org.jgroups.Address member) |
void |
unblock() |
void |
viewAccepted(org.jgroups.View view) |
public JGroupsCommandDispatcher(String id, org.jgroups.Channel channel, long timeout, C context, Stateful stateful, MembershipListener membershipListener) throws Exception
id
- the channel namechannel
- a JGroups channeltimeout
- the command timeoutcontext
- the execution contextstateful
- the state transfer handlermembershipListener
- notified of membership changesException
- if channel cannot be createdpublic 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 <R> Map<Member,R> executeAll(Command<R,C> command)
executeAll
in interface CommandDispatcher<C>
R
- the return value typecommand
- the command to executeCommandDispatcher.executeAll(net.sf.hajdbc.distributed.Command)
public <R> R executeCoordinator(Command<R,C> command)
executeCoordinator
in interface CommandDispatcher<C>
R
- the return value typecommand
- the command to executeCommandDispatcher.executeCoordinator(net.sf.hajdbc.distributed.Command)
public boolean isCoordinator()
isCoordinator
in interface CommandDispatcher<C>
CommandDispatcher.isCoordinator()
public Member getLocal()
getLocal
in interface CommandDispatcher<C>
CommandDispatcher.getLocal()
public Member getCoordinator()
getCoordinator
in interface CommandDispatcher<C>
CommandDispatcher.getCoordinator()
public Object handle(org.jgroups.Message message)
handle
in interface org.jgroups.blocks.RequestHandler
RequestHandler.handle(org.jgroups.Message)
public void viewAccepted(org.jgroups.View view)
viewAccepted
in interface org.jgroups.MembershipListener
MembershipListener.viewAccepted(org.jgroups.View)
public void getState(OutputStream output) throws Exception
getState
in interface org.jgroups.MessageListener
Exception
MessageListener.getState(java.io.OutputStream)
public void setState(InputStream input) throws Exception
setState
in interface org.jgroups.MessageListener
Exception
MessageListener.setState(java.io.InputStream)
public void suspect(org.jgroups.Address member)
suspect
in interface org.jgroups.MembershipListener
MembershipListener.suspect(org.jgroups.Address)
public void block()
block
in interface org.jgroups.MembershipListener
MembershipListener.block()
public void unblock()
unblock
in interface org.jgroups.MembershipListener
MembershipListener.unblock()
public void receive(org.jgroups.Message message)
receive
in interface org.jgroups.MessageListener
MessageListener.receive(org.jgroups.Message)
Copyright © 2004–2013 Paul Ferraro. All rights reserved.