public class MessageDispatchInterceptor extends ChannelInterceptorBase implements MessageDispatchInterceptorMBean
Channel.SEND_OPTIONS_ASYNCHRONOUS
flag to be set, if it is, it
will queue the message for delivery and immediately return to the sender.ChannelInterceptor.InterceptorEvent
Modifier and Type | Field and Description |
---|---|
protected boolean |
alwaysSend |
protected AtomicLong |
currentSize |
protected ExecutorService |
executor |
protected long |
keepAliveTime |
protected long |
maxQueueSize |
protected int |
maxSpareThreads |
protected int |
maxThreads |
protected boolean |
run |
protected static StringManager |
sm |
protected boolean |
useDeepClone |
optionFlag
Constructor and Description |
---|
MessageDispatchInterceptor() |
Modifier and Type | Method and Description |
---|---|
long |
addAndGetCurrentSize(long inc) |
boolean |
addToQueue(ChannelMessage msg,
Member[] destination,
InterceptorPayload payload) |
int |
getActiveCount()
Return the current number of threads that are in use.
|
long |
getCompletedTaskCount()
Return the total number of tasks that have completed execution by the pool.
|
long |
getCurrentSize() |
long |
getKeepAliveTime() |
long |
getMaxQueueSize() |
int |
getMaxSpareThreads() |
int |
getMaxThreads() |
int |
getPoolSize()
Return the current number of threads that are managed by the pool.
|
long |
getTaskCount()
Return the total number of tasks that have ever been scheduled for execution by the pool.
|
boolean |
getUseDeepClone() |
boolean |
isAlwaysSend() |
protected void |
sendAsyncData(ChannelMessage msg,
Member[] destination,
InterceptorPayload payload) |
void |
sendMessage(Member[] destination,
ChannelMessage msg,
InterceptorPayload payload)
The
sendMessage method is called when a message is being sent to one more destinations. |
void |
setAlwaysSend(boolean alwaysSend) |
long |
setAndGetCurrentSize(long value) |
void |
setKeepAliveTime(long keepAliveTime) |
void |
setMaxQueueSize(long maxQueueSize) |
void |
setMaxSpareThreads(int maxSpareThreads) |
void |
setMaxThreads(int maxThreads) |
void |
setOptionFlag(int flag)
Sets the option flag
|
void |
setUseDeepClone(boolean useDeepClone) |
void |
start(int svc)
Starts up the channel.
|
void |
startQueue() |
void |
stop(int svc)
Shuts down the channel.
|
void |
stopQueue() |
fireInterceptorEvent, getChannel, getLocalMember, getMember, getMembers, getNext, getOptionFlag, getPrevious, hasMembers, heartbeat, memberAdded, memberDisappeared, messageReceived, okToProcess, setChannel, setNext, setPrevious
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getOptionFlag
protected static final StringManager sm
protected long maxQueueSize
protected volatile boolean run
protected boolean useDeepClone
protected boolean alwaysSend
protected final AtomicLong currentSize
protected ExecutorService executor
protected int maxThreads
protected int maxSpareThreads
protected long keepAliveTime
public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException
ChannelInterceptor
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)
sendMessage
in interface ChannelInterceptor
sendMessage
in class ChannelInterceptorBase
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
- if a serialization error happens.ErrorHandler
,
InterceptorPayload
public boolean addToQueue(ChannelMessage msg, Member[] destination, InterceptorPayload payload)
public void startQueue()
public void stopQueue()
public void setOptionFlag(int flag)
ChannelInterceptor
setOptionFlag
in interface ChannelInterceptor
setOptionFlag
in class ChannelInterceptorBase
flag
- intChannelInterceptor.getOptionFlag()
public void setMaxQueueSize(long maxQueueSize)
public void setUseDeepClone(boolean useDeepClone)
public long getMaxQueueSize()
getMaxQueueSize
in interface MessageDispatchInterceptorMBean
public boolean getUseDeepClone()
public long getCurrentSize()
getCurrentSize
in interface MessageDispatchInterceptorMBean
public long addAndGetCurrentSize(long inc)
public long setAndGetCurrentSize(long value)
public long getKeepAliveTime()
getKeepAliveTime
in interface MessageDispatchInterceptorMBean
public int getMaxSpareThreads()
getMaxSpareThreads
in interface MessageDispatchInterceptorMBean
public int getMaxThreads()
getMaxThreads
in interface MessageDispatchInterceptorMBean
public void setKeepAliveTime(long keepAliveTime)
public void setMaxSpareThreads(int maxSpareThreads)
public void setMaxThreads(int maxThreads)
public boolean isAlwaysSend()
isAlwaysSend
in interface MessageDispatchInterceptorMBean
public void setAlwaysSend(boolean alwaysSend)
setAlwaysSend
in interface MessageDispatchInterceptorMBean
public void start(int svc) throws ChannelException
ChannelInterceptorBase
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
ChannelInterceptorBase
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 sendAsyncData(ChannelMessage msg, Member[] destination, InterceptorPayload payload)
public int getPoolSize()
getPoolSize
in interface MessageDispatchInterceptorMBean
public int getActiveCount()
getActiveCount
in interface MessageDispatchInterceptorMBean
public long getTaskCount()
getTaskCount
in interface MessageDispatchInterceptorMBean
public long getCompletedTaskCount()
getCompletedTaskCount
in interface MessageDispatchInterceptorMBean
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.