public abstract class ChannelInterceptorBase extends Object implements ChannelInterceptor
ChannelInterceptor.InterceptorEvent| Modifier and Type | Field and Description |
|---|---|
protected int |
optionFlag |
| Constructor and Description |
|---|
ChannelInterceptorBase() |
| Modifier and Type | Method and Description |
|---|---|
void |
fireInterceptorEvent(ChannelInterceptor.InterceptorEvent event) |
Channel |
getChannel()
Return the channel that is related to this interceptor
|
Member |
getLocalMember(boolean incAlive)
Return the member that represents this node.
|
Member |
getMember(Member mbr)
Intercepts the
Channel.getMember(Member) method |
Member[] |
getMembers()
Get all current cluster members
|
ChannelInterceptor |
getNext()
Retrieve the next interceptor in the list
|
int |
getOptionFlag()
An interceptor can react to a message based on a set bit on the
message options.
|
ChannelInterceptor |
getPrevious()
Retrieve the previous interceptor in the list
|
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. |
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. |
boolean |
okToProcess(int messageFlags) |
void |
sendMessage(Member[] destination,
ChannelMessage msg,
InterceptorPayload payload)
The
sendMessage method is called when a message is being sent to one more destinations. |
void |
setChannel(Channel channel)
Set the channel that is related to this interceptor
|
void |
setNext(ChannelInterceptor next)
Set the next interceptor in the list of interceptors
|
void |
setOptionFlag(int optionFlag)
Sets the option flag
|
void |
setPrevious(ChannelInterceptor previous)
Set the previous interceptor in the list
|
void |
start(int svc)
Starts up the channel.
|
void |
stop(int svc)
Shuts down the channel.
|
public boolean okToProcess(int messageFlags)
public final void setNext(ChannelInterceptor next)
ChannelInterceptorsetNext in interface ChannelInterceptornext - ChannelInterceptorpublic final ChannelInterceptor getNext()
ChannelInterceptorgetNext in interface ChannelInterceptorpublic final void setPrevious(ChannelInterceptor previous)
ChannelInterceptorsetPrevious in interface ChannelInterceptorprevious - ChannelInterceptorpublic void setOptionFlag(int optionFlag)
ChannelInterceptorsetOptionFlag in interface ChannelInterceptoroptionFlag - intChannelInterceptor.getOptionFlag()public final ChannelInterceptor getPrevious()
ChannelInterceptorgetPrevious in interface ChannelInterceptorpublic int getOptionFlag()
ChannelInterceptorboolean react = (getOptionFlag() == (getOptionFlag() & ChannelMessage.getOptions()));getOptionFlag in interface ChannelInterceptorChannelMessage.getOptions()public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException
ChannelInterceptorsendMessage method is called when a message is being sent to one more destinations.
The interceptor can modify any of the parameters and then pass on the message down the stack by
invoking getNext().sendMessage(destination,msg,payload)getNext().sendMessage(destination,msg,payload)sendMessage in interface ChannelInterceptordestination - Member[] - the destination for this messagemsg - ChannelMessage - the message to be sentpayload - InterceptorPayload - the payload, carrying an error handler and future useful data, can be nullChannelException - if a serialization error happens.ErrorHandler,
InterceptorPayloadpublic void messageReceived(ChannelMessage msg)
ChannelInterceptormessageReceived 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 ChannelInterceptormsg - ChannelMessagepublic void memberAdded(Member member)
MembershipListenermemberAdded in interface MembershipListenermember - Member - the member that was addedpublic void memberDisappeared(Member member)
MembershipListenermemberDisappeared in interface MembershipListenermember - MemberMember.SHUTDOWN_PAYLOADpublic void heartbeat()
ChannelInterceptorheartbeat() 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 ChannelInterceptorheartbeat in interface Heartbeatpublic boolean hasMembers()
hasMembers in interface ChannelInterceptorChannel.hasMembers()public Member[] getMembers()
getMembers in interface ChannelInterceptorChannel.getMembers()public Member getMember(Member mbr)
ChannelInterceptorChannel.getMember(Member) methodgetMember in interface ChannelInterceptormbr - MemberChannel.getMember(Member)public Member getLocalMember(boolean incAlive)
getLocalMember in interface ChannelInterceptorincAlive - booleanChannel.getLocalMember(boolean)public void start(int svc)
throws ChannelException
start in interface ChannelInterceptorsvc - int value of ChannelException - if a startup error occurs or the service is already started.Channelpublic void stop(int svc)
throws ChannelException
stop in interface ChannelInterceptorsvc - int value of ChannelException - if a startup error occurs or the service is already started.Channelpublic void fireInterceptorEvent(ChannelInterceptor.InterceptorEvent event)
fireInterceptorEvent in interface ChannelInterceptorpublic Channel getChannel()
getChannel in interface ChannelInterceptorpublic void setChannel(Channel channel)
setChannel in interface ChannelInterceptorchannel - The channelCopyright © 2000-2021 Apache Software Foundation. All Rights Reserved.