|
Apache Tomcat 6.0.53 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.catalina.tribes.group.ChannelInterceptorBase org.apache.catalina.tribes.group.ChannelCoordinator
public class ChannelCoordinator
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.ChannelInterceptor |
---|
ChannelInterceptor.InterceptorEvent |
Field Summary | |
---|---|
protected int |
optionFlag
|
Fields inherited from class org.apache.catalina.tribes.group.ChannelInterceptorBase |
---|
log |
Constructor Summary | |
---|---|
ChannelCoordinator()
|
|
ChannelCoordinator(ChannelReceiver receiver,
ChannelSender sender,
MembershipService service)
|
Method Summary | |
---|---|
ChannelReceiver |
getClusterReceiver()
|
ChannelSender |
getClusterSender()
|
Member |
getLocalMember(boolean incAlive)
Return the member that represents this node. |
Member |
getMember(Member mbr)
Intercepts the code>Channel.getMember(Member) method |
Member[] |
getMembers()
Get all current cluster members |
MembershipService |
getMembershipService()
|
int |
getOptionFlag()
An interceptor can react to a message based on a set bit on the message options. |
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 |
setOptionFlag(int flag)
Sets the option flag |
void |
start(int svc)
Starts up the channel. |
void |
stop(int svc)
Shuts down the channel. |
Methods inherited from class org.apache.catalina.tribes.group.ChannelInterceptorBase |
---|
accept, fireInterceptorEvent, getNext, getPrevious, okToProcess, setNext, setPrevious |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.catalina.tribes.MessageListener |
---|
accept, equals, hashCode |
Field Detail |
---|
protected int optionFlag
Constructor Detail |
---|
public ChannelCoordinator()
public ChannelCoordinator(ChannelReceiver receiver, ChannelSender sender, MembershipService service)
Method Detail |
---|
public int getOptionFlag()
ChannelInterceptor
boolean react = (getOptionFlag() == (getOptionFlag() & ChannelMessage.getOptions()));
getOptionFlag
in interface ChannelInterceptor
getOptionFlag
in class ChannelInterceptorBase
ChannelMessage.getOptions()
public void setOptionFlag(int flag)
ChannelInterceptor
setOptionFlag
in interface ChannelInterceptor
setOptionFlag
in class ChannelInterceptorBase
flag
- intChannelInterceptor.getOptionFlag()
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
- InterceptorPayload - the payload, carrying an error handler and future useful data, can be null
ChannelException
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
getMember
in interface ChannelInterceptor
getMember
in class ChannelInterceptorBase
mbr
- Member
Channel.getMember(Member)
public Member getLocalMember(boolean incAlive)
getLocalMember
in interface ChannelInterceptor
getLocalMember
in class ChannelInterceptorBase
incAlive
- boolean
Channel.getLocalMember(boolean)
|
Apache Tomcat 6.0.53 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |