org.apache.catalina.tribes.group

Class ChannelCoordinator

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.

Version: $Revision: 532943 $, $Date: 2007-04-27 05:14:58 +0200 (Fri, 27 Apr 2007) $

Author: Filip Hanik

Field Summary
protected intoptionFlag
Constructor Summary
ChannelCoordinator()
ChannelCoordinator(ChannelReceiver receiver, ChannelSender sender, MembershipService service)
Method Summary
ChannelReceivergetClusterReceiver()
ChannelSendergetClusterSender()
MembergetLocalMember(boolean incAlive)
Return the member that represents this node.
MembergetMember(Member mbr)
Member[]getMembers()
Get all current cluster members
MembershipServicegetMembershipService()
intgetOptionFlag()
booleanhasMembers()
has members
voidheartbeat()
protected voidinternalStart(int svc)
Starts up the channel.
protected voidinternalStop(int svc)
Shuts down the channel.
voidmemberAdded(Member member)
voidmemberDisappeared(Member member)
voidmessageReceived(ChannelMessage msg)
voidsendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload)
Send a message to one or more members in the cluster
voidsetClusterReceiver(ChannelReceiver clusterReceiver)
voidsetClusterSender(ChannelSender clusterSender)
voidsetMembershipService(MembershipService membershipService)
voidsetOptionFlag(int flag)
voidstart(int svc)
Starts up the channel.
voidstop(int svc)
Shuts down the channel.

Field Detail

optionFlag

protected int optionFlag

Constructor Detail

ChannelCoordinator

public ChannelCoordinator()

ChannelCoordinator

public ChannelCoordinator(ChannelReceiver receiver, ChannelSender sender, MembershipService service)

Method Detail

getClusterReceiver

public ChannelReceiver getClusterReceiver()

getClusterSender

public ChannelSender getClusterSender()

getLocalMember

public Member getLocalMember(boolean incAlive)
Return the member that represents this node.

Returns: Member

getMember

public Member getMember(Member mbr)

Parameters: mbr Member

Returns: Member

getMembers

public Member[] getMembers()
Get all current cluster members

Returns: all members or empty array

getMembershipService

public MembershipService getMembershipService()

getOptionFlag

public int getOptionFlag()

hasMembers

public boolean hasMembers()
has members

heartbeat

public void heartbeat()

internalStart

protected void internalStart(int svc)
Starts 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.

internalStop

protected void internalStop(int svc)
Shuts 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.

memberAdded

public void memberAdded(Member member)

memberDisappeared

public void memberDisappeared(Member member)

messageReceived

public void messageReceived(ChannelMessage msg)

sendMessage

public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload)
Send a message to one or more members in the cluster

Parameters: destination Member[] - the destinations, null or zero length means all msg ClusterMessage - the message to send options int - sender options, see class documentation

Returns: ClusterMessage[] - the replies from the members, if any.

setClusterReceiver

public void setClusterReceiver(ChannelReceiver clusterReceiver)

setClusterSender

public void setClusterSender(ChannelSender clusterSender)

setMembershipService

public void setMembershipService(MembershipService membershipService)

setOptionFlag

public void setOptionFlag(int flag)

start

public void start(int svc)
Starts 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.

stop

public void stop(int svc)
Shuts 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 - 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.

Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.