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> R |
execute(Command<R,C> command,
Member member)
Execute the specified command on the specified member.
|
<R> Map<Member,R> |
executeAll(Command<R,C> command,
Member... excludedMembers)
Execute the specified command on all members, potentially excluding some.
|
AddressMember |
getCoordinator()
Returns the group coordinator.
|
AddressMember |
getLocal()
Returns the local member.
|
void |
getState(OutputStream output) |
Object |
handle(org.jgroups.Message message) |
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, Member... excludedMembers)
CommandDispatcher
executeAll
in interface CommandDispatcher<C>
R
- the return value typecommand
- the command to executeexcludedMembers
- list of members to optionally excludepublic <R> R execute(Command<R,C> command, Member member)
execute
in interface CommandDispatcher<C>
R
- the return value typecommand
- the command to executemember
- the member on which to execute the commandnet.sf.hajdbc.distributed.CommandDispatcher#executeCoordinator(net.sf.hajdbc.distributed.Command)
public AddressMember getLocal()
getLocal
in interface CommandDispatcher<C>
CommandDispatcher.getLocal()
public AddressMember 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–2014 Paul Ferraro. All rights reserved.