| |
|
| java.lang.Object org.apache.catalina.tribes.group.ChannelInterceptorBase org.apache.catalina.tribes.group.GroupChannel
GroupChannel | public class GroupChannel extends ChannelInterceptorBase implements ManagedChannel(Code) | | 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.
author: Filip Hanik version: $Revision: 500684 $, $Date: 2007-01-28 00:27:18 +0100 (dim., 28 janv. 2007) $ |
Inner Class :public static class InterceptorIterator implements Iterator | |
Inner Class :public static class HeartbeatThread extends Thread | |
Constructor Summary | |
public | GroupChannel() Creates a GroupChannel. |
channelListeners | protected ArrayList channelListeners(Code) | | A list of channel listeners that subscribe to incoming messages
|
coordinator | protected ChannelCoordinator coordinator(Code) | | The ChannelCoordinator coordinates the bottom layer components:
- MembershipService
- ChannelSender
- ChannelReceiver
|
hbthread | protected HeartbeatThread hbthread(Code) | | Internal heartbeat thread
|
heartbeat | protected boolean heartbeat(Code) | | 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.
|
heartbeatSleeptime | protected long heartbeatSleeptime(Code) | | If heartbeat == true then how often do we want this
heartbeat to run. default is one minute
|
interceptors | protected ChannelInterceptor interceptors(Code) | | The first interceptor in the inteceptor stack.
The interceptors are chained in a linked list, so we only need a reference to the
first one
|
membershipListeners | protected ArrayList membershipListeners(Code) | | A list of membership listeners that subscribe to membership announcements
|
optionCheck | protected boolean optionCheck(Code) | | If set to true, the GroupChannel will check to make sure that
|
GroupChannel | public GroupChannel()(Code) | | Creates a GroupChannel. This constructor will also
add the first interceptor in the GroupChannel.
The first interceptor is always the channel itself.
|
addChannelListener | public void addChannelListener(ChannelListener channelListener)(Code) | | Adds a channel listener to the channel.
Channel listeners are uniquely identified using the equals(Object) method
Parameters: channelListener - ChannelListener |
addInterceptor | public void addInterceptor(ChannelInterceptor interceptor)(Code) | | Adds an interceptor to the stack for message processing
Interceptors are ordered in the way they are added.
channel.addInterceptor(A);
channel.addInterceptor(C);
channel.addInterceptor(B);
Will result in a interceptor stack like this:
A -> C -> B
The complete stack will look like this:
Channel -> A -> C -> B -> ChannelCoordinator
Parameters: interceptor - ChannelInterceptorBase |
addMembershipListener | public void addMembershipListener(MembershipListener membershipListener)(Code) | | Adds a membership listener to the channel.
Membership listeners are uniquely identified using the equals(Object) method
Parameters: membershipListener - MembershipListener |
checkOptionFlags | protected void checkOptionFlags() throws ChannelException(Code) | | Validates the option flags that each interceptor is using and reports
an error if two interceptor share the same flag.
throws: ChannelException - |
getChannelReceiver | public ChannelReceiver getChannelReceiver()(Code) | | Returns the channel receiver component
ChannelReceiver |
getChannelSender | public ChannelSender getChannelSender()(Code) | | Returns the channel sender component
ChannelSender |
getFirstInterceptor | public ChannelInterceptor getFirstInterceptor()(Code) | | Returns the first interceptor of the stack. Useful for traversal.
ChannelInterceptor |
getHeartbeatSleeptime | public long getHeartbeatSleeptime()(Code) | | Returns the sleep time in milliseconds that the internal heartbeat will
sleep in between invokations of Channel.heartbeat()
long |
getInterceptors | public Iterator getInterceptors()(Code) | | Returns an iterator of all the interceptors in this stack
Iterator |
getMembershipService | public MembershipService getMembershipService()(Code) | | Returns the membership service component
MembershipService |
heartbeat | public void heartbeat()(Code) | | Sends a heartbeat through the interceptor stack.
Invoke this method from the application on a periodic basis if
you have turned off internal heartbeats channel.setHeartbeat(false)
|
memberAdded | public void memberAdded(Member member)(Code) | | memberAdded gets invoked by the interceptor below the channel
and the channel will broadcast it to the membership listeners
Parameters: member - Member - the new member |
memberDisappeared | public void memberDisappeared(Member member)(Code) | | memberDisappeared gets invoked by the interceptor below the channel
and the channel will broadcast it to the membership listeners
Parameters: member - Member - the member that left or crashed |
messageReceived | public void messageReceived(ChannelMessage msg)(Code) | | Callback from the interceptor stack.
When a message is received from a remote node, this method will be invoked by
the previous interceptor.
This method can also be used to send a message to other components within the same application,
but its an extreme case, and you're probably better off doing that logic between the applications itself.
Parameters: msg - ChannelMessage |
removeChannelListener | public void removeChannelListener(ChannelListener channelListener)(Code) | | Removes a channel listener from the channel.
Channel listeners are uniquely identified using the equals(Object) method
Parameters: channelListener - ChannelListener |
removeMembershipListener | public void removeMembershipListener(MembershipListener membershipListener)(Code) | | Removes a membership listener from the channel.
Membership listeners are uniquely identified using the equals(Object) method
Parameters: membershipListener - MembershipListener |
send | public UniqueId send(Member[] destination, Serializable msg, int options) throws ChannelException(Code) | | Send a message to the destinations specified
Parameters: destination - Member[] - destination.length > 1 Parameters: msg - Serializable - the message to send Parameters: options - int - sender options, options can trigger guarantee levels and different interceptors toreact to the message see class documentation for the Channel object. UniqueId - the unique Id that was assigned to this message throws: ChannelException - - if an error occurs processing the message See Also: org.apache.catalina.tribes.Channel |
send | public UniqueId send(Member[] destination, Serializable msg, int options, ErrorHandler handler) throws ChannelException(Code) | | Parameters: destination - Member[] - destination.length > 1 Parameters: msg - Serializable - the message to send Parameters: options - int - sender options, options can trigger guarantee levels and different interceptors toreact to the message see class documentation for the Channel object.
Parameters: handler - - callback object for error handling and completion notification, used when a message issent asynchronously using the Channel.SEND_OPTIONS_ASYNCHRONOUS flag enabled. UniqueId - the unique Id that was assigned to this message throws: ChannelException - - if an error occurs processing the message See Also: org.apache.catalina.tribes.Channel |
sendNoRpcChannelReply | protected void sendNoRpcChannelReply(RpcMessage msg, Member destination)(Code) | | Sends a NoRpcChannelReply message to a member
This method gets invoked by the channel if a RPC message comes in
and no channel listener accepts the message. This avoids timeout
Parameters: msg - RpcMessage Parameters: destination - Member - the destination for the reply |
setChannelReceiver | public void setChannelReceiver(ChannelReceiver clusterReceiver)(Code) | | Sets the channel receiver component
Parameters: clusterReceiver - ChannelReceiver |
setChannelSender | public void setChannelSender(ChannelSender clusterSender)(Code) | | Sets the channel sender component
Parameters: clusterSender - ChannelSender |
setHeartbeat | public void setHeartbeat(boolean heartbeat)(Code) | | Enables or disables local heartbeat.
if setHeartbeat(true) is invoked then the channel will start an internal
thread to invoke Channel.heartbeat() every getHeartbeatSleeptime milliseconds
Parameters: heartbeat - boolean |
setHeartbeatSleeptime | public void setHeartbeatSleeptime(long heartbeatSleeptime)(Code) | | Configure local heartbeat sleep time
Only used when getHeartbeat()==true
Parameters: heartbeatSleeptime - long - time in milliseconds to sleep between heartbeats |
setMembershipService | public void setMembershipService(MembershipService membershipService)(Code) | | Sets the membership component
Parameters: membershipService - MembershipService |
setOptionCheck | public void setOptionCheck(boolean optionCheck)(Code) | | Enables/disables the option check
Setting this to true, will make the GroupChannel perform a conflict check
on the interceptors. If two interceptors are using the same option flag
and throw an error upon start.
Parameters: optionCheck - boolean |
setupDefaultStack | protected synchronized void setupDefaultStack() throws ChannelException(Code) | | Sets up the default implementation interceptor stack
if no interceptors have been added
throws: ChannelException - |
|
|
|