Package org.apache.catalina.tribes.group
Class ChannelCoordinator
- java.lang.Object
- 
- org.apache.catalina.tribes.group.ChannelInterceptorBase
- 
- org.apache.catalina.tribes.group.ChannelCoordinator
 
 
- 
- All Implemented Interfaces:
- ChannelInterceptor,- Heartbeat,- MembershipListener,- MessageListener
 
 public class ChannelCoordinator extends ChannelInterceptorBase implements MessageListener The channel coordinator object coordinates the membership service, the sender and the receiver. This is the last interceptor in the chain.
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from interface org.apache.catalina.tribes.ChannelInterceptorChannelInterceptor.InterceptorEvent
 
- 
 - 
Field SummaryFields Modifier and Type Field Description protected static StringManagersm- 
Fields inherited from class org.apache.catalina.tribes.group.ChannelInterceptorBaseoptionFlag
 
- 
 - 
Constructor SummaryConstructors Constructor Description ChannelCoordinator()ChannelCoordinator(ChannelReceiver receiver, ChannelSender sender, MembershipService service)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaccept(ChannelMessage msg)ChannelReceivergetClusterReceiver()ChannelSendergetClusterSender()MembergetLocalMember(boolean incAlive)Return the member that represents this node.MembergetMember(Member mbr)Intercepts theChannel.getMember(Member)methodMember[]getMembers()Get all current cluster membersMembershipServicegetMembershipService()booleanhasMembers()has membersvoidheartbeat()Theheartbeat()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 voidinternalStart(int svc)Starts up the channel.protected voidinternalStop(int svc)Shuts down the channel.voidmemberAdded(Member member)A member was added to the groupvoidmemberDisappeared(Member member)A member was removed from the group
 If the member left voluntarily, the Member.getCommand will contain the Member.SHUTDOWN_PAYLOAD datavoidmessageReceived(ChannelMessage msg)themessageReceivedis invoked when a message is received.voidsendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload)Send a message to one or more members in the clustervoidsetClusterReceiver(ChannelReceiver clusterReceiver)voidsetClusterSender(ChannelSender clusterSender)voidsetMembershipService(MembershipService membershipService)voidstart(int svc)Starts up the channel.voidstop(int svc)Shuts down the channel.- 
Methods inherited from class org.apache.catalina.tribes.group.ChannelInterceptorBasefireInterceptorEvent, getChannel, getNext, getOptionFlag, getPrevious, okToProcess, setChannel, setNext, setOptionFlag, setPrevious
 
- 
 
- 
- 
- 
Field Detail- 
smprotected static final StringManager sm 
 
- 
 - 
Constructor Detail- 
ChannelCoordinatorpublic ChannelCoordinator() 
 - 
ChannelCoordinatorpublic ChannelCoordinator(ChannelReceiver receiver, ChannelSender sender, MembershipService service) 
 
- 
 - 
Method Detail- 
sendMessagepublic void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException Send a message to one or more members in the cluster- Specified by:
- sendMessagein interface- ChannelInterceptor
- Overrides:
- sendMessagein class- ChannelInterceptorBase
- Parameters:
- destination- Member[] - the destinations, null or zero length means all
- msg- ClusterMessage - the message to send
- payload- TBA
- Throws:
- ChannelException- if a serialization error happens.
- See Also:
- ErrorHandler,- InterceptorPayload
 
 - 
startpublic void start(int svc) throws ChannelExceptionStarts up the channel. This can be called multiple times for individual services to start The svc parameter can be the logical or value of any constants- Specified by:
- startin interface- ChannelInterceptor
- Overrides:
- startin class- ChannelInterceptorBase
- Parameters:
- svc- int value of
 DEFAULT - will start all services
 MBR_RX_SEQ - starts the membership receiver
 MBR_TX_SEQ - starts the membership broadcaster
 SND_TX_SEQ - starts the replication transmitter
 SND_RX_SEQ - starts the replication receiver
- Throws:
- ChannelException- if a startup error occurs or the service is already started.
- See Also:
- Channel
 
 - 
stoppublic void stop(int svc) throws ChannelExceptionShuts down the channel. This can be called multiple times for individual services to shutdown The svc parameter can be the logical or value of any constants- Specified by:
- stopin interface- ChannelInterceptor
- Overrides:
- stopin class- ChannelInterceptorBase
- Parameters:
- svc- int value of
 DEFAULT - will shutdown all services
 MBR_RX_SEQ - stops the membership receiver
 MBR_TX_SEQ - stops the membership broadcaster
 SND_TX_SEQ - stops the replication transmitter
 SND_RX_SEQ - stops the replication receiver
- Throws:
- ChannelException- if a startup error occurs or the service is already started.
- See Also:
- Channel
 
 - 
internalStartprotected void internalStart(int svc) throws ChannelExceptionStarts up the channel. This can be called multiple times for individual services to start The svc parameter can be the logical or value of any constants- Parameters:
- svc- int value of
 DEFAULT - will start all services
 MBR_RX_SEQ - starts the membership receiver
 MBR_TX_SEQ - starts the membership broadcaster
 SND_TX_SEQ - starts the replication transmitter
 SND_RX_SEQ - starts the replication receiver
- Throws:
- ChannelException- if a startup error occurs or the service is already started.
 
 - 
internalStopprotected void internalStop(int svc) throws ChannelExceptionShuts down the channel. This can be called multiple times for individual services to shutdown The svc parameter can be the logical or value of any constants- Parameters:
- svc- int value of
 DEFAULT - will shutdown all services
 MBR_RX_SEQ - starts the membership receiver
 MBR_TX_SEQ - starts the membership broadcaster
 SND_TX_SEQ - starts the replication transmitter
 SND_RX_SEQ - starts the replication receiver
- Throws:
- ChannelException- if a startup error occurs or the service is already started.
 
 - 
memberAddedpublic void memberAdded(Member member) Description copied from interface:MembershipListenerA member was added to the group- Specified by:
- memberAddedin interface- MembershipListener
- Overrides:
- memberAddedin class- ChannelInterceptorBase
- Parameters:
- member- Member - the member that was added
 
 - 
memberDisappearedpublic void memberDisappeared(Member member) Description copied from interface:MembershipListenerA member was removed from the group
 If the member left voluntarily, the Member.getCommand will contain the Member.SHUTDOWN_PAYLOAD data- Specified by:
- memberDisappearedin interface- MembershipListener
- Overrides:
- memberDisappearedin class- ChannelInterceptorBase
- Parameters:
- member- Member
- See Also:
- Member.SHUTDOWN_PAYLOAD
 
 - 
messageReceivedpublic void messageReceived(ChannelMessage msg) Description copied from interface:ChannelInterceptorthemessageReceivedis invoked when a message is received.ChannelMessage.getAddress()is the sender, or the reply-to address if it has been overwritten.- Specified by:
- messageReceivedin interface- ChannelInterceptor
- Specified by:
- messageReceivedin interface- MessageListener
- Overrides:
- messageReceivedin class- ChannelInterceptorBase
- Parameters:
- msg- ChannelMessage
 
 - 
acceptpublic boolean accept(ChannelMessage msg) - Specified by:
- acceptin interface- MessageListener
 
 - 
getClusterReceiverpublic ChannelReceiver getClusterReceiver() 
 - 
getClusterSenderpublic ChannelSender getClusterSender() 
 - 
getMembershipServicepublic MembershipService getMembershipService() 
 - 
setClusterReceiverpublic void setClusterReceiver(ChannelReceiver clusterReceiver) 
 - 
setClusterSenderpublic void setClusterSender(ChannelSender clusterSender) 
 - 
setMembershipServicepublic void setMembershipService(MembershipService membershipService) 
 - 
heartbeatpublic void heartbeat() Description copied from interface:ChannelInterceptorTheheartbeat()method gets invoked periodically to allow interceptors to clean up resources, time out object and perform actions that are unrelated to sending/receiving data.- Specified by:
- heartbeatin interface- ChannelInterceptor
- Specified by:
- heartbeatin interface- Heartbeat
- Overrides:
- heartbeatin class- ChannelInterceptorBase
 
 - 
hasMemberspublic boolean hasMembers() has members- Specified by:
- hasMembersin interface- ChannelInterceptor
- Overrides:
- hasMembersin class- ChannelInterceptorBase
- Returns:
- boolean - if the channel has members in its membership group
- See Also:
- Channel.hasMembers()
 
 - 
getMemberspublic Member[] getMembers() Get all current cluster members- Specified by:
- getMembersin interface- ChannelInterceptor
- Overrides:
- getMembersin class- ChannelInterceptorBase
- Returns:
- all members or empty array
- See Also:
- Channel.getMembers()
 
 - 
getMemberpublic Member getMember(Member mbr) Description copied from interface:ChannelInterceptorIntercepts theChannel.getMember(Member)method- Specified by:
- getMemberin interface- ChannelInterceptor
- Overrides:
- getMemberin class- ChannelInterceptorBase
- Parameters:
- mbr- Member
- Returns:
- Member
- See Also:
- Channel.getMember(Member)
 
 - 
getLocalMemberpublic Member getLocalMember(boolean incAlive) Return the member that represents this node.- Specified by:
- getLocalMemberin interface- ChannelInterceptor
- Overrides:
- getLocalMemberin class- ChannelInterceptorBase
- Parameters:
- incAlive- boolean
- Returns:
- Member
- See Also:
- Channel.getLocalMember(boolean)
 
 
- 
 
-