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
The channel coordinator object coordinates the membership service,
 the sender and the receiver.
 This is the last interceptor in the chain.
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.apache.catalina.tribes.ChannelInterceptorChannelInterceptor.InterceptorEvent
- 
Field SummaryFieldsFields inherited from class org.apache.catalina.tribes.group.ChannelInterceptorBaseoptionFlag
- 
Constructor SummaryConstructorsConstructorDescriptionChannelCoordinator(ChannelReceiver receiver, ChannelSender sender, MembershipService service) 
- 
Method SummaryModifier and TypeMethodDescriptionbooleanaccept(ChannelMessage msg) getLocalMember(boolean incAlive) Return the member that represents this node.Intercepts theChannel.getMember(Member)methodMember[]Get all current cluster membersbooleanhas membersvoidTheheartbeat()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 datavoidthemessageReceivedis 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 Details- 
sm
 
- 
- 
Constructor Details- 
ChannelCoordinatorpublic ChannelCoordinator()
- 
ChannelCoordinatorpublic ChannelCoordinator(ChannelReceiver receiver, ChannelSender sender, MembershipService service) 
 
- 
- 
Method Details- 
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:
 
- 
startStarts 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:
 
- 
stopShuts 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:
 
- 
internalStartStarts 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.
 
- 
internalStopShuts 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.
 
- 
memberAddedDescription 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
 
- 
memberDisappearedDescription 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:
 
- 
messageReceivedDescription 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
 
- 
accept- Specified by:
- acceptin interface- MessageListener
 
- 
getClusterReceiver
- 
getClusterSender
- 
getMembershipService
- 
setClusterReceiver
- 
setClusterSender
- 
setMembershipService
- 
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:
 
- 
getMembersGet all current cluster members- Specified by:
- getMembersin interface- ChannelInterceptor
- Overrides:
- getMembersin class- ChannelInterceptorBase
- Returns:
- all members or empty array
- See Also:
 
- 
getMemberDescription copied from interface:ChannelInterceptorIntercepts theChannel.getMember(Member)method- Specified by:
- getMemberin interface- ChannelInterceptor
- Overrides:
- getMemberin class- ChannelInterceptorBase
- Parameters:
- mbr- Member
- Returns:
- Member
- See Also:
 
- 
getLocalMemberReturn the member that represents this node.- Specified by:
- getLocalMemberin interface- ChannelInterceptor
- Overrides:
- getLocalMemberin class- ChannelInterceptorBase
- Parameters:
- incAlive- boolean
- Returns:
- Member
- See Also:
 
 
-