|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jgroups.stack.Protocol org.jgroups.protocols.SCOPE
public class SCOPE
Implements https://jira.jboss.org/jira/browse/JGRP-822, which allows for concurrent delivery of messages from the same sender based on scopes. Similar to using OOB messages, but messages within the same scope are ordered.
Nested Class Summary | |
---|---|
protected class |
SCOPE.ExpiryTask
|
protected static class |
SCOPE.MessageQueue
|
protected class |
SCOPE.QueueThread
|
static class |
SCOPE.ScopeHeader
|
Field Summary | |
---|---|
protected java.lang.String |
cluster_name
|
protected long |
expiration_interval
|
protected long |
expiration_time
|
protected java.util.concurrent.Future<?> |
expiry_task
|
protected Address |
local_addr
|
protected java.util.concurrent.ConcurrentMap<Address,java.util.concurrent.ConcurrentMap<java.lang.Short,SCOPE.MessageQueue>> |
queues
Used to find the correct AckReceiverWindow on message reception and deliver it in the right order |
protected ThreadFactory |
thread_factory
|
protected java.lang.String |
thread_naming_pattern
|
protected java.util.concurrent.Executor |
thread_pool
|
protected long |
thread_pool_keep_alive_time
|
protected int |
thread_pool_max_threads
|
protected int |
thread_pool_min_threads
|
protected TimeScheduler |
timer
|
Fields inherited from class org.jgroups.stack.Protocol |
---|
down_prot, ergonomics, id, log, name, stack, stats, up_prot |
Constructor Summary | |
---|---|
SCOPE()
|
Method Summary | |
---|---|
void |
clearQueue(Address member)
|
protected static java.util.concurrent.ExecutorService |
createThreadPool(int min_threads,
int max_threads,
long keep_alive_time,
ThreadFactory factory)
|
java.lang.Object |
down(Event evt)
An event is to be sent down the stack. |
java.lang.String |
dumpScopes()
|
void |
expire(short scope)
Multicasts an EXPIRE message to all members, and - on reception - each member removes the scope locally |
int |
getNumActiveThreads()
|
int |
getNumberOfMessages()
|
int |
getNumberOfReceiverScopes()
|
protected SCOPE.MessageQueue |
getOrCreateQueue(Address sender,
short scope)
|
long |
getThreadPoolKeepAliveTime()
|
int |
getThreadPoolMaxThreads()
|
int |
getThreadPoolMinThreads()
|
void |
init()
Called after instance has been created (null constructor) and before protocol is started. |
void |
removeAllQueues()
|
void |
removeScope(Address member,
short scope)
|
void |
setThreadPoolKeepAliveTime(long time)
|
void |
setThreadPoolMaxThreads(int size)
|
void |
setThreadPoolMinThreads(int size)
|
protected static void |
shutdownThreadPool(java.util.concurrent.Executor thread_pool)
|
void |
start()
This method is called on a Channel.connect(String) . |
protected void |
startExpiryTask()
|
void |
stop()
This method is called on a Channel.disconnect() . |
protected void |
stopExpiryTask()
|
java.lang.Object |
up(Event evt)
An event was received from the layer below. |
Methods inherited from class org.jgroups.stack.Protocol |
---|
destroy, dumpStats, enableStats, getConfigurableObjects, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getName, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, printStats, providedDownServices, providedUpServices, requiredDownServices, requiredUpServices, resetStatistics, resetStats, setDownProtocol, setErgonomics, setId, setLevel, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, statsEnabled |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int thread_pool_min_threads
protected int thread_pool_max_threads
protected long thread_pool_keep_alive_time
protected java.lang.String thread_naming_pattern
protected long expiration_time
protected long expiration_interval
protected java.util.concurrent.Future<?> expiry_task
protected final java.util.concurrent.ConcurrentMap<Address,java.util.concurrent.ConcurrentMap<java.lang.Short,SCOPE.MessageQueue>> queues
protected java.lang.String cluster_name
protected Address local_addr
protected java.util.concurrent.Executor thread_pool
protected ThreadFactory thread_factory
protected TimeScheduler timer
Constructor Detail |
---|
public SCOPE()
Method Detail |
---|
public int getNumberOfReceiverScopes()
public int getNumberOfMessages()
public void setThreadPoolMinThreads(int size)
public int getThreadPoolMinThreads()
public void setThreadPoolMaxThreads(int size)
public int getThreadPoolMaxThreads()
public void setThreadPoolKeepAliveTime(long time)
public long getThreadPoolKeepAliveTime()
public void removeAllQueues()
public void expire(short scope)
scope
- public void removeScope(Address member, short scope)
public java.lang.String dumpScopes()
public int getNumActiveThreads()
public void init() throws java.lang.Exception
Protocol
init
in class Protocol
java.lang.Exception
- Thrown if protocol cannot be initialized successfully. This will cause the
ProtocolStack to fail, so the channel constructor will throw an exceptionpublic void start() throws java.lang.Exception
Protocol
Channel.connect(String)
. Starts work.
Protocols are connected and queues are ready to receive events.
Will be called from bottom to top. This call will replace
the START and START_OK events.
start
in class Protocol
java.lang.Exception
- Thrown if protocol cannot be started successfully. This will cause the ProtocolStack
to fail, so Channel.connect(String)
will throw an exceptionpublic void stop()
Protocol
Channel.disconnect()
. Stops work (e.g. by closing multicast socket).
Will be called from top to bottom. This means that at the time of the method invocation the
neighbor protocol below is still working. This method will replace the
STOP, STOP_OK, CLEANUP and CLEANUP_OK events. The ProtocolStack guarantees that
when this method is called all messages in the down queue will have been flushed
stop
in class Protocol
public java.lang.Object down(Event evt)
Protocol
down_prot.down()
. In case of a GET_ADDRESS event (which tries to
retrieve the stack's address from one of the bottom layers), the layer may need to send
a new response event back up the stack using up_prot.up()
.
down
in class Protocol
public java.lang.Object up(Event evt)
Protocol
down_prot.down()
or c) the event (or another event) is sent up
the stack using up_prot.up()
.
up
in class Protocol
protected SCOPE.MessageQueue getOrCreateQueue(Address sender, short scope)
protected void startExpiryTask()
protected void stopExpiryTask()
protected static java.util.concurrent.ExecutorService createThreadPool(int min_threads, int max_threads, long keep_alive_time, ThreadFactory factory)
protected static void shutdownThreadPool(java.util.concurrent.Executor thread_pool)
public void clearQueue(Address member)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |