Package org.jgroups.protocols
Class SCOPE
java.lang.Object
org.jgroups.stack.Protocol
org.jgroups.protocols.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.
- Since:
- 2.10
- Author:
- Bela Ban
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classprotected static classprotected classstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected longprotected longprotected Future<?> protected Addressprotected final ConcurrentMap<Address, ConcurrentMap<Short, SCOPE.MessageQueue>> Used to find the correct AckReceiverWindow on message reception and deliver it in the right orderprotected ThreadFactoryprotected ThreadGroupprotected Stringprotected Executorprotected longprotected intprotected intprotected TimeScheduler -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclearQueue(Address member) protected static ExecutorServicecreateThreadPool(int min_threads, int max_threads, long keep_alive_time, ThreadFactory factory) An event is to be sent down the stack.voidexpire(short scope) Multicasts an EXPIRE message to all members, and - on reception - each member removes the scope locallyintintintprotected SCOPE.MessageQueuegetOrCreateQueue(Address sender, short scope) longintintvoidinit()Called after instance has been created (null constructor) and before protocol is started.voidvoidremoveScope(Address member, short scope) voidsetThreadPoolKeepAliveTime(long time) voidsetThreadPoolMaxThreads(int size) voidsetThreadPoolMinThreads(int size) protected static voidshutdownThreadPool(Executor thread_pool) voidstart()This method is called on aChannel.connect(String).protected voidvoidstop()This method is called on aChannel.disconnect().protected voidAn event was received from the layer below.Methods inherited from class org.jgroups.stack.Protocol
destroy, downThreadEnabled, dumpStats, enableStats, getConfigurableObjects, getDownProtocol, getId, getLevel, getName, getProperties, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getValue, isErgonomics, printStats, providedDownServices, providedUpServices, requiredDownServices, requiredUpServices, resetStats, setDownProtocol, setErgonomics, setId, setLevel, setProperties, setPropertiesInternal, setProperty, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, statsEnabled, upThreadEnabled
-
Field Details
-
thread_pool_min_threads
protected int thread_pool_min_threads -
thread_pool_max_threads
protected int thread_pool_max_threads -
thread_pool_keep_alive_time
protected long thread_pool_keep_alive_time -
thread_naming_pattern
-
expiration_time
protected long expiration_time -
expiration_interval
protected long expiration_interval -
expiry_task
-
queues
Used to find the correct AckReceiverWindow on message reception and deliver it in the right order -
cluster_name
-
local_addr
-
thread_pool
-
thread_group
-
thread_factory
-
timer
-
-
Constructor Details
-
SCOPE
public SCOPE()
-
-
Method Details
-
getNumberOfReceiverScopes
public int getNumberOfReceiverScopes() -
getNumberOfMessages
public int getNumberOfMessages() -
setThreadPoolMinThreads
public void setThreadPoolMinThreads(int size) -
getThreadPoolMinThreads
public int getThreadPoolMinThreads() -
setThreadPoolMaxThreads
public void setThreadPoolMaxThreads(int size) -
getThreadPoolMaxThreads
public int getThreadPoolMaxThreads() -
setThreadPoolKeepAliveTime
public void setThreadPoolKeepAliveTime(long time) -
getThreadPoolKeepAliveTime
public long getThreadPoolKeepAliveTime() -
removeAllQueues
public void removeAllQueues() -
expire
public void expire(short scope) Multicasts an EXPIRE message to all members, and - on reception - each member removes the scope locally- Parameters:
scope-
-
removeScope
-
dumpScopes
-
getNumActiveThreads
public int getNumActiveThreads() -
init
Description copied from class:ProtocolCalled after instance has been created (null constructor) and before protocol is started. Properties are already set. Other protocols are not yet connected and events cannot yet be sent. -
start
Description copied from class:ProtocolThis method is called on aChannel.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.- Overrides:
startin classProtocol- Throws:
Exception- Thrown if protocol cannot be started successfully. This will cause the ProtocolStack to fail, soChannel.connect(String)will throw an exception
-
stop
public void stop()Description copied from class:ProtocolThis method is called on aChannel.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 -
down
Description copied from class:ProtocolAn event is to be sent down the stack. The layer may want to examine its type and perform some action on it, depending on the event's type. If the event is a message MSG, then the layer may need to add a header to it (or do nothing at all) before sending it down the stack usingdown_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 usingup_prot.up(). -
up
Description copied from class:ProtocolAn event was received from the layer below. Usually the current layer will want to examine the event type and - depending on its type - perform some computation (e.g. removing headers from a MSG event type, or updating the internal membership list when receiving a VIEW_CHANGE event). Finally the event is either a) discarded, or b) an event is sent down the stack usingdown_prot.down()or c) the event (or another event) is sent up the stack usingup_prot.up(). -
getOrCreateQueue
-
startExpiryTask
protected void startExpiryTask() -
stopExpiryTask
protected void stopExpiryTask() -
createThreadPool
protected static ExecutorService createThreadPool(int min_threads, int max_threads, long keep_alive_time, ThreadFactory factory) -
shutdownThreadPool
-
clearQueue
-