public class ChannelCoordinator extends ChannelInterceptorBase implements MessageListener
ChannelInterceptor.InterceptorEvent
optionFlag
Constructor and Description |
---|
ChannelCoordinator() |
ChannelCoordinator(ChannelReceiver receiver,
ChannelSender sender,
MembershipService service) |
Modifier and Type | Method and Description |
---|---|
ChannelReceiver |
getClusterReceiver() |
ChannelSender |
getClusterSender() |
Member |
getLocalMember(boolean incAlive)
Return the member that represents this node.
|
Member |
getMember(Member mbr)
Intercepts the
Channel.getMember(Member) method |
Member[] |
getMembers()
Get all current cluster members
|
MembershipService |
getMembershipService() |
boolean |
hasMembers()
has members
|
void |
heartbeat()
The
heartbeat() method gets invoked periodically
to allow interceptors to clean up resources, time out object and
perform actions that are unrelated to sending/receiving data. |
protected void |
internalStart(int svc)
Starts up the channel.
|
protected void |
internalStop(int svc)
Shuts down the channel.
|
void |
memberAdded(Member member)
A member was added to the group
|
void |
memberDisappeared(Member member)
A member was removed from the group
If the member left voluntarily, the Member.getCommand will contain the Member.SHUTDOWN_PAYLOAD data |
void |
messageReceived(ChannelMessage msg)
the
messageReceived is invoked when a message is received. |
void |
sendMessage(Member[] destination,
ChannelMessage msg,
InterceptorPayload payload)
Send a message to one or more members in the cluster
|
void |
setClusterReceiver(ChannelReceiver clusterReceiver) |
void |
setClusterSender(ChannelSender clusterSender) |
void |
setMembershipService(MembershipService membershipService) |
void |
start(int svc)
Starts up the channel.
|
void |
stop(int svc)
Shuts down the channel.
|
accept, fireInterceptorEvent, getChannel, getNext, getOptionFlag, getPrevious, okToProcess, setChannel, setNext, setOptionFlag, setPrevious
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
accept, equals, hashCode
public ChannelCoordinator()
public ChannelCoordinator(ChannelReceiver receiver, ChannelSender sender, MembershipService service)
public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException
sendMessage
in interface ChannelInterceptor
sendMessage
in class ChannelInterceptorBase
destination
- Member[] - the destinations, null or zero length means allmsg
- ClusterMessage - the message to sendpayload
- TBAChannelException
- if a serialization error happens.ErrorHandler
,
InterceptorPayload
public void start(int svc) throws ChannelException
start
in interface ChannelInterceptor
start
in class ChannelInterceptorBase
svc
- int value of ChannelException
- if a startup error occurs or the service is already started.Channel
public void stop(int svc) throws ChannelException
stop
in interface ChannelInterceptor
stop
in class ChannelInterceptorBase
svc
- int value of ChannelException
- if a startup error occurs or the service is already started.Channel
protected void internalStart(int svc) throws ChannelException
svc
- int value of ChannelException
- if a startup error occurs or the service is already started.protected void internalStop(int svc) throws ChannelException
svc
- int value of ChannelException
- if a startup error occurs or the service is already started.public void memberAdded(Member member)
MembershipListener
memberAdded
in interface MembershipListener
memberAdded
in class ChannelInterceptorBase
member
- Member - the member that was addedpublic void memberDisappeared(Member member)
MembershipListener
memberDisappeared
in interface MembershipListener
memberDisappeared
in class ChannelInterceptorBase
member
- MemberMember.SHUTDOWN_PAYLOAD
public void messageReceived(ChannelMessage msg)
ChannelInterceptor
messageReceived
is invoked when a message is received.
ChannelMessage.getAddress()
is the sender, or the reply-to address
if it has been overwritten.messageReceived
in interface ChannelInterceptor
messageReceived
in interface MessageListener
messageReceived
in class ChannelInterceptorBase
msg
- ChannelMessagepublic ChannelReceiver getClusterReceiver()
public ChannelSender getClusterSender()
public MembershipService getMembershipService()
public void setClusterReceiver(ChannelReceiver clusterReceiver)
public void setClusterSender(ChannelSender clusterSender)
public void setMembershipService(MembershipService membershipService)
public void heartbeat()
ChannelInterceptor
heartbeat()
method gets invoked periodically
to allow interceptors to clean up resources, time out object and
perform actions that are unrelated to sending/receiving data.heartbeat
in interface ChannelInterceptor
heartbeat
in interface Heartbeat
heartbeat
in class ChannelInterceptorBase
public boolean hasMembers()
hasMembers
in interface ChannelInterceptor
hasMembers
in class ChannelInterceptorBase
Channel.hasMembers()
public Member[] getMembers()
getMembers
in interface ChannelInterceptor
getMembers
in class ChannelInterceptorBase
Channel.getMembers()
public Member getMember(Member mbr)
ChannelInterceptor
Channel.getMember(Member)
methodgetMember
in interface ChannelInterceptor
getMember
in class ChannelInterceptorBase
mbr
- MemberChannel.getMember(Member)
public Member getLocalMember(boolean incAlive)
getLocalMember
in interface ChannelInterceptor
getLocalMember
in class ChannelInterceptorBase
incAlive
- booleanChannel.getLocalMember(boolean)
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.