public interface ChannelInterceptor extends MembershipListener, Heartbeat
ChannelInterceptorBase
Modifier and Type | Interface and Description |
---|---|
static interface |
ChannelInterceptor.InterceptorEvent |
Modifier and Type | Method and Description |
---|---|
void |
fireInterceptorEvent(ChannelInterceptor.InterceptorEvent event) |
Member |
getLocalMember(boolean incAliveTime)
Intercepts the code>Channel.getLocalMember(boolean) method
|
Member |
getMember(Member mbr)
Intercepts the code>Channel.getMember(Member) method
|
Member[] |
getMembers()
Intercepts the code>Channel.getMembers() method
|
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()
Intercepts the
Channel.hasMembers() method |
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 |
messageReceived(ChannelMessage data)
the
messageReceived is invoked when a message is received. |
void |
sendMessage(Member[] destination,
ChannelMessage msg,
InterceptorPayload payload)
The
sendMessage method is called when a message is being sent to one more destinations. |
void |
setNext(ChannelInterceptor next)
Set the next interceptor in the list of interceptors
|
void |
setOptionFlag(int flag)
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.
|
memberAdded, memberDisappeared
int getOptionFlag()
boolean react = (getOptionFlag() == (getOptionFlag() & ChannelMessage.getOptions()));
ChannelMessage.getOptions()
void setOptionFlag(int flag)
flag
- intgetOptionFlag()
void setNext(ChannelInterceptor next)
next
- ChannelInterceptorChannelInterceptor getNext()
void setPrevious(ChannelInterceptor previous)
previous
- ChannelInterceptorChannelInterceptor getPrevious()
void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException
sendMessage
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)
destination
- 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
ErrorHandler
,
InterceptorPayload
void messageReceived(ChannelMessage data)
messageReceived
is invoked when a message is received.
ChannelMessage.getAddress()
is the sender, or the reply-to address
if it has been overwritten.data
- ChannelMessagevoid heartbeat()
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.boolean hasMembers()
Channel.hasMembers()
methodChannel.hasMembers()
Member[] getMembers()
Channel.getMembers()
Member getLocalMember(boolean incAliveTime)
incAliveTime
- booleanChannel.getLocalMember(boolean)
Member getMember(Member mbr)
mbr
- MemberChannel.getMember(Member)
void start(int svc) throws ChannelException
svc
- int value of ChannelException
- if a startup error occurs or the service is already started.Channel
void stop(int svc) throws ChannelException
svc
- int value of ChannelException
- if a startup error occurs or the service is already started.Channel
void fireInterceptorEvent(ChannelInterceptor.InterceptorEvent event)
Copyright © 2000-2015 Apache Software Foundation. All Rights Reserved.