|
Apache Tomcat 6.0.51 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.catalina.tribes.group.ChannelInterceptorBase
org.apache.catalina.tribes.group.GroupChannel
public class GroupChannel
The default implementation of a Channel.
The GroupChannel manages the replication channel. It coordinates
message being sent and received with membership announcements.
The channel has an chain of interceptors that can modify the message or perform other logic.
It manages a complete group, both membership and replication.
| Nested Class Summary | |
|---|---|
static class |
GroupChannel.HeartbeatThread
Title: Internal heartbeat thread Description: if Channel.getHeartbeat()==true then a thread of this class
is created |
static class |
GroupChannel.InterceptorIterator
Title: Interceptor Iterator Description: An iterator to loop through the interceptors in a channel |
| Nested classes/interfaces inherited from interface org.apache.catalina.tribes.ChannelInterceptor |
|---|
ChannelInterceptor.InterceptorEvent |
| Field Summary | |
|---|---|
protected java.util.ArrayList |
channelListeners
A list of channel listeners that subscribe to incoming messages |
protected ChannelCoordinator |
coordinator
The ChannelCoordinator coordinates the bottom layer components:- MembershipService - ChannelSender - ChannelReceiver |
protected GroupChannel.HeartbeatThread |
hbthread
Internal heartbeat thread |
protected boolean |
heartbeat
Flag to determine if the channel manages its own heartbeat If set to true, the channel will start a local thread for the heart beat. |
protected long |
heartbeatSleeptime
If heartbeat == true then how often do we want this
heartbeat to run. default is one minute |
protected ChannelInterceptor |
interceptors
The first interceptor in the inteceptor stack. |
protected java.util.ArrayList |
membershipListeners
A list of membership listeners that subscribe to membership announcements |
protected boolean |
optionCheck
If set to true, the GroupChannel will check to make sure that |
| Fields inherited from class org.apache.catalina.tribes.group.ChannelInterceptorBase |
|---|
log, optionFlag |
| Fields inherited from interface org.apache.catalina.tribes.Channel |
|---|
DEFAULT, MBR_RX_SEQ, MBR_TX_SEQ, SEND_OPTIONS_ASYNCHRONOUS, SEND_OPTIONS_BYTE_MESSAGE, SEND_OPTIONS_DEFAULT, SEND_OPTIONS_SECURE, SEND_OPTIONS_SYNCHRONIZED_ACK, SEND_OPTIONS_USE_ACK, SND_RX_SEQ, SND_TX_SEQ |
| Constructor Summary | |
|---|---|
GroupChannel()
Creates a GroupChannel. |
|
| Method Summary | |
|---|---|
void |
addChannelListener(ChannelListener channelListener)
Adds a channel listener to the channel. |
void |
addInterceptor(ChannelInterceptor interceptor)
Adds an interceptor to the stack for message processing Interceptors are ordered in the way they are added. |
void |
addMembershipListener(MembershipListener membershipListener)
Adds a membership listener to the channel. |
protected void |
checkOptionFlags()
Validates the option flags that each interceptor is using and reports an error if two interceptor share the same flag. |
ChannelReceiver |
getChannelReceiver()
Returns the channel receiver component |
ChannelSender |
getChannelSender()
Returns the channel sender component |
ChannelInterceptor |
getFirstInterceptor()
Returns the first interceptor of the stack. |
boolean |
getHeartbeat()
|
long |
getHeartbeatSleeptime()
Returns the sleep time in milliseconds that the internal heartbeat will sleep in between invokations of Channel.heartbeat() |
java.util.Iterator |
getInterceptors()
Returns an iterator of all the interceptors in this stack |
MembershipService |
getMembershipService()
Returns the membership service component |
boolean |
getOptionCheck()
|
void |
heartbeat()
Sends a heartbeat through the interceptor stack. |
void |
memberAdded(Member member)
memberAdded gets invoked by the interceptor below the channel and the channel will broadcast it to the membership listeners |
void |
memberDisappeared(Member member)
memberDisappeared gets invoked by the interceptor below the channel and the channel will broadcast it to the membership listeners |
void |
messageReceived(ChannelMessage msg)
Callback from the interceptor stack. |
void |
removeChannelListener(ChannelListener channelListener)
Removes a channel listener from the channel. |
void |
removeMembershipListener(MembershipListener membershipListener)
Removes a membership listener from the channel. |
UniqueId |
send(Member[] destination,
java.io.Serializable msg,
int options)
Send a message to the destinations specified |
UniqueId |
send(Member[] destination,
java.io.Serializable msg,
int options,
ErrorHandler handler)
Send a message to one or more members in the cluster |
protected void |
sendNoRpcChannelReply(RpcMessage msg,
Member destination)
Sends a NoRpcChannelReply message to a memberThis method gets invoked by the channel if a RPC message comes in and no channel listener accepts the message. |
void |
setChannelReceiver(ChannelReceiver clusterReceiver)
Sets the channel receiver component |
void |
setChannelSender(ChannelSender clusterSender)
Sets the channel sender component |
void |
setHeartbeat(boolean heartbeat)
Enables or disables local heartbeat. |
void |
setHeartbeatSleeptime(long heartbeatSleeptime)
Configure local heartbeat sleep time Only used when getHeartbeat()==true |
void |
setMembershipService(MembershipService membershipService)
Sets the membership component |
void |
setOptionCheck(boolean optionCheck)
Enables/disables the option check Setting this to true, will make the GroupChannel perform a conflict check on the interceptors. |
protected void |
setupDefaultStack()
Sets up the default implementation interceptor stack if no interceptors have been added |
void |
start(int svc)
Starts the channel |
void |
stop(int svc)
Stops the channel |
| Methods inherited from class org.apache.catalina.tribes.group.ChannelInterceptorBase |
|---|
accept, fireInterceptorEvent, getLocalMember, getMember, getMembers, getNext, getOptionFlag, getPrevious, hasMembers, okToProcess, sendMessage, setNext, setOptionFlag, 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.Channel |
|---|
getLocalMember, getMember, getMembers, hasMembers |
| Field Detail |
|---|
protected boolean heartbeat
protected long heartbeatSleeptime
heartbeat == true then how often do we want this
heartbeat to run. default is one minute
protected GroupChannel.HeartbeatThread hbthread
protected ChannelCoordinator coordinator
ChannelCoordinator coordinates the bottom layer components:
protected ChannelInterceptor interceptors
protected java.util.ArrayList membershipListeners
protected java.util.ArrayList channelListeners
protected boolean optionCheck
| Constructor Detail |
|---|
public GroupChannel()
| Method Detail |
|---|
public void addInterceptor(ChannelInterceptor interceptor)
channel.addInterceptor(A);channel.addInterceptor(C);channel.addInterceptor(B);A -> C -> BChannel -> A -> C -> B -> ChannelCoordinator
addInterceptor in interface Channelinterceptor - ChannelInterceptorBasepublic void heartbeat()
channel.setHeartbeat(false)
heartbeat in interface Channelheartbeat in interface ChannelInterceptorheartbeat in interface Heartbeatheartbeat in class ChannelInterceptorBaseChannel.setHeartbeat(boolean)
public UniqueId send(Member[] destination,
java.io.Serializable msg,
int options)
throws ChannelException
send in interface Channeldestination - Member[] - destination.length > 1msg - Serializable - the message to sendoptions - int - sender options, options can trigger guarantee levels and different interceptors to
react to the message see class documentation for the Channel object.ChannelException - - if an error occurs processing the messageChannel
public UniqueId send(Member[] destination,
java.io.Serializable msg,
int options,
ErrorHandler handler)
throws ChannelException
Channel
send in interface Channeldestination - Member[] - destination.length > 1msg - Serializable - the message to sendoptions - int - sender options, options can trigger guarantee levels and different interceptors to
react to the message see class documentation for the Channel object.handler - - callback object for error handling and completion notification, used when a message is
sent asynchronously using the Channel.SEND_OPTIONS_ASYNCHRONOUS flag enabled.
ChannelException - - if an error occurs processing the messageChannelpublic void messageReceived(ChannelMessage msg)
messageReceived in interface ChannelInterceptormessageReceived in class ChannelInterceptorBasemsg - ChannelMessage
protected void sendNoRpcChannelReply(RpcMessage msg,
Member destination)
NoRpcChannelReply message to a member
msg - RpcMessagedestination - Member - the destination for the replypublic void memberAdded(Member member)
memberAdded in interface MembershipListenermemberAdded in class ChannelInterceptorBasemember - Member - the new memberpublic void memberDisappeared(Member member)
memberDisappeared in interface MembershipListenermemberDisappeared in class ChannelInterceptorBasemember - Member - the member that left or crashedMember.SHUTDOWN_PAYLOAD
protected void setupDefaultStack()
throws ChannelException
ChannelException
protected void checkOptionFlags()
throws ChannelException
ChannelException
public void start(int svc)
throws ChannelException
start in interface Channelstart in interface ChannelInterceptorstart in class ChannelInterceptorBasesvc - int - what service to start
ChannelExceptionChannel.start(int)
public void stop(int svc)
throws ChannelException
stop in interface Channelstop in interface ChannelInterceptorstop in class ChannelInterceptorBasesvc - int
ChannelExceptionChannel.stop(int)public ChannelInterceptor getFirstInterceptor()
public ChannelReceiver getChannelReceiver()
getChannelReceiver in interface ManagedChannelChannelReceiverpublic ChannelSender getChannelSender()
getChannelSender in interface ManagedChannelChannelSenderpublic MembershipService getMembershipService()
getMembershipService in interface ManagedChannelMembershipServicepublic void setChannelReceiver(ChannelReceiver clusterReceiver)
setChannelReceiver in interface ManagedChannelclusterReceiver - ChannelReceiverChannelReceiverpublic void setChannelSender(ChannelSender clusterSender)
setChannelSender in interface ManagedChannelclusterSender - ChannelSenderChannelSenderpublic void setMembershipService(MembershipService membershipService)
setMembershipService in interface ManagedChannelmembershipService - MembershipServiceMembershipServicepublic void addMembershipListener(MembershipListener membershipListener)
addMembershipListener in interface ChannelmembershipListener - MembershipListenerMembershipListenerpublic void removeMembershipListener(MembershipListener membershipListener)
removeMembershipListener in interface ChannelmembershipListener - MembershipListenerMembershipListenerpublic void addChannelListener(ChannelListener channelListener)
addChannelListener in interface ChannelchannelListener - ChannelListenerChannelListener,
Heartbeatpublic void removeChannelListener(ChannelListener channelListener)
removeChannelListener in interface ChannelchannelListener - ChannelListenerChannelListenerpublic java.util.Iterator getInterceptors()
getInterceptors in interface ManagedChannelChannel.addInterceptor(ChannelInterceptor)public void setOptionCheck(boolean optionCheck)
optionCheck - booleanpublic void setHeartbeatSleeptime(long heartbeatSleeptime)
getHeartbeat()==true
heartbeatSleeptime - long - time in milliseconds to sleep between heartbeatspublic void setHeartbeat(boolean heartbeat)
setHeartbeat(true) is invoked then the channel will start an internal
thread to invoke Channel.heartbeat() every getHeartbeatSleeptime milliseconds
setHeartbeat in interface Channelheartbeat - booleanChannel.heartbeat()public boolean getOptionCheck()
setOptionCheck(boolean)public boolean getHeartbeat()
setHeartbeat(boolean)public long getHeartbeatSleeptime()
Channel.heartbeat()
|
Apache Tomcat 6.0.51 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||