public class ChannelImpl<T> extends Object implements IChannel<T>
| Modifier and Type | Class and Description |
|---|---|
class |
ChannelImpl.RegistrationTypes |
| Modifier | Constructor and Description |
|---|---|
protected |
ChannelImpl(String messageId,
MessageDispatcherImpl messageDispatcher,
String name,
Map<String,Object> configurationProperties,
Map<String,Object> stateProperties) |
| Modifier and Type | Method and Description |
|---|---|
void |
addOnChannelAttach(IOnChannelAttach onChannelAttach) |
void |
checkForChannelManager(ChannelManagerContainer controllerContainer,
ChannelBindingModifyFlags bindingModifyFlags) |
void |
checkForService(ServiceContainer serviceContainer,
ChannelBindingModifyFlags bindingModifyFlags) |
protected boolean |
checkFreeWorker(ChannelWorker worker,
long nextRun) |
boolean |
checkTimeOut() |
protected boolean |
checkWorkerShutdown(ChannelWorker worker) |
protected int |
cleanDoneTasks() |
void |
closeWorkerSnapshots() |
ISubChannel |
createChildScope(UUID scopeId,
String scopeName,
ISubChannel parentScope,
Map<String,Object> configurationProperties,
Map<String,Object> stateProperties,
boolean adoptContoller,
boolean adoptServices)
create
ISubChannel for IChannel |
void |
dispose() |
ISubChannel |
getChildScope(UUID scopeId)
returns scope with given
scopeId |
List<ISubChannel> |
getChildScopes()
getter for child scope list.
|
protected List<ISubChannel> |
getChildSessionScopes(UUID parentScopeId) |
IPropertyBlock |
getConfigurationPropertyBlock()
getter for configuration propertyblock of queue
|
List<ChannelManagerContainer> |
getControllerContainerList() |
TaskContainer |
getCurrentRunningTask() |
IMessageDispatcher |
getDispatcher()
getter for global dispatchter service
|
protected long |
getDueTasks(List<TaskContainer> dueTaskList) |
MessageDispatcherImpl |
getEventDispatcher() |
int |
getEventListLimit() |
String |
getId()
getter for channel id
|
long |
getLastWorkerAction() |
int |
getManagerSize() |
IMessage |
getMessage(String uuid)
returns
IMessage queued with uuid |
protected ReentrantLock |
getMessageEventLock() |
DequeSnapshot<IMessage<T>> |
getMessageSnapshot()
return message snapshot
|
DequeSnapshot<IMessage<T>> |
getMessageSnapshotPoll()
return message snapshot-poll (remove returned elements from channel)
|
String |
getName() |
protected DequeSnapshot<? extends IMessage> |
getNewScheduledEventsSnaphot() |
protected long |
getNextRun() |
DequeSnapshot<IOnChannelAttach> |
getOnQueueAttachList() |
ChannelConfigurationModifyListener |
getQueueConfigurationModifyListener() |
protected DequeSnapshot<? extends IMessage> |
getRemovedEventsSnapshot() |
IChannel |
getRootChannel()
returns root scope
|
List<ServiceContainer> |
getServiceList() |
int |
getServiceSize() |
protected DequeSnapshot<String> |
getSignalsSnapshot() |
IPropertyBlock |
getStatePropertyBlock()
getter for state propertyblock of queue
|
IChannelTask |
getTask(String id)
returns
IChannelTask scheduled under registration id |
IPropertyBlock |
getTaskPropertyBlock(String id)
returns properties of
IChannelTask scheduled under registration id |
protected void |
notifyOrCreateWorker(long nextRuntimeStamp) |
void |
recalcRegistrationTypes() |
protected boolean |
removeMessage(MessageImpl message) |
boolean |
removeMessage(String uuid)
remove
IMessage queued with uuid |
boolean |
removeMessageList(List<String> uuidList)
remove list of
IMessages queued with one of uuids |
IChannelTask |
removeTask(String id)
remove
IChannelTask scheduled under registration id |
IChannelTask |
rescheduleTask(String id,
long executionTimeStamp,
long timeOutValue,
long heartBeatTimeOut)
reset execution plan for an existing
IChannelTask |
String |
scheduleTask(IChannelTask task)
schedule a anonymous
IChannelTask to IChannel
equivalent to scheduleTask(null,task, null, -1, -1, -1); |
String |
scheduleTask(String id,
IChannelTask task)
schedule a
IChannelTask to IChannel. |
String |
scheduleTask(String id,
IChannelTask task,
IPropertyBlock propertyBlock,
long executionTimeStamp,
long timeOutValue,
long heartBeatTimeOut)
schedule a
IChannelTask to IChannel. |
String |
scheduleTask(String id,
IChannelTask task,
IPropertyBlock propertyBlock,
long executionTimeStamp,
long timeOutValue,
long heartBeatTimeOut,
boolean stopOnTimeOut)
schedule a
IChannelTask to IChannel. |
void |
setEventListLimit(int eventListLimit) |
boolean |
setManager(ChannelManagerContainer controllerContainer) |
void |
setName(String name) |
void |
setQueueConfigurationModifyListener(ChannelConfigurationModifyListener queueConfigurationModifyListener) |
boolean |
setService(ServiceContainer serviceContainer,
boolean createOnly) |
void |
signal(String signal)
Sends a signal.
|
void |
stopQueueWorker() |
void |
storeMessage(T messagePayload,
Consumer<MessageHeader> messageHeaderConfiguration)
store a message
|
Future<IOnMessageStoreResult> |
storeMessageWithResult(T messagePayload,
Consumer<MessageHeader> messageHeaderSetter)
store a message with result
|
void |
touchLastWorkerAction() |
boolean |
unsetChannelManager(ChannelManagerContainer configurationContainer,
boolean unregisterInScope) |
boolean |
unsetService(ServiceContainer serviceContainer,
boolean unregisterInScope) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateChildScope, getAdapter, getAdapter, removeAdapter, setAdapter, storeMessage, storeMessageWithResultprotected static final String PROPERTY_KEY_TASK_ID
protected static final String PROPERTY_PERIODIC_REPETITION_INTERVAL
protected static final String PROPERTY_KEY_THROWED_EXCEPTION
protected String name
protected volatile int capacity
protected MessageDispatcherImpl messageDispatcher
protected String channelId
protected List<ChannelManagerContainer> channelManagerList
protected volatile List<ChannelManagerContainer> controllerListCopy
protected Map<ChannelManagerContainer,ChannelManagerContainer> channelManagerIndex
protected ReentrantReadWriteLock channelManagerListLock
protected ReentrantReadWriteLock.ReadLock channelManagerListReadLock
protected ReentrantReadWriteLock.WriteLock channelManagerListWriteLock
protected List<ServiceContainer> channelServiceList
protected Map<ServiceContainer,ServiceContainer> channelServiceIndex
protected volatile List<ServiceContainer> serviceListCopy
protected ReentrantReadWriteLock channelServiceListLock
protected ReentrantReadWriteLock.ReadLock channelServiceListReadLock
protected ReentrantReadWriteLock.WriteLock channelServiceListWriteLock
protected SnapshotableDeque<MessageImpl> messageQueue
protected SnapshotableDeque<MessageImpl> newPublishedMessageQueue
protected SnapshotableDeque<MessageImpl> removedMessageQueue
protected List<TaskContainer> taskList
protected Map<String,TaskContainer> taskIndex
protected ReentrantReadWriteLock taskListLock
protected ReentrantReadWriteLock.ReadLock taskListReadLock
protected ReentrantReadWriteLock.WriteLock taskListWriteLock
protected volatile boolean signalListUpdate
protected SnapshotableDeque<String> channelSignalList
protected volatile boolean onQueueAttachListUpdate
protected SnapshotableDeque<IOnChannelAttach> onChannelAttachList
protected volatile ChannelWorker queueWorker
protected volatile SpooledChannelWorker currentSpooledQueueWorker
protected volatile long lastWorkerAction
protected PropertyBlockImpl configurationPropertyBlock
protected PropertyBlockImpl statePropertyBlock
protected volatile boolean newScheduledListUpdate
protected volatile boolean removedEventListUpdate
protected volatile boolean firedEventListUpdate
protected ReentrantLock genericChannelSpoolLock
protected ReentrantLock workerSpoolLock
protected volatile boolean disposed
protected volatile boolean privateWorker
protected volatile ChannelConfigurationModifyListener channelConfigurationModifyListener
protected List<SubChannelImpl> subChannelList
protected Map<UUID,SubChannelImpl> subChannelIndex
protected volatile List<ISubChannel> subChannelListCopy
protected ReentrantReadWriteLock subChannelListLock
protected ReentrantReadWriteLock.ReadLock subChannelListReadLock
protected ReentrantReadWriteLock.WriteLock queueScopeListWriteLock
protected DummyPublishMessageResult dummyPublishMessageResult
protected ChannelImpl parent
protected LinkedList<DequeSnapshot<IMessage<T>>> snapshotsByWorkerThread
protected ReentrantLock sharedMessageLock
protected volatile ChannelImpl.RegistrationTypes registrationTypes
public void storeMessage(T messagePayload, Consumer<MessageHeader> messageHeaderConfiguration)
IChannelstoreMessage in interface IChannel<T>messagePayload - payload of message to store in channelmessageHeaderConfiguration - consumer to set message header propertiespublic Future<IOnMessageStoreResult> storeMessageWithResult(T messagePayload, Consumer<MessageHeader> messageHeaderSetter)
IChannelstoreMessageWithResult in interface IChannel<T>messagePayload - payload of message to store in channelmessageHeaderSetter - consumer to set message header propertiesIOnMessageStoreResultpublic void checkForChannelManager(ChannelManagerContainer controllerContainer, ChannelBindingModifyFlags bindingModifyFlags)
public boolean setManager(ChannelManagerContainer controllerContainer)
public boolean unsetChannelManager(ChannelManagerContainer configurationContainer, boolean unregisterInScope)
public int getManagerSize()
public void checkForService(ServiceContainer serviceContainer, ChannelBindingModifyFlags bindingModifyFlags)
public boolean setService(ServiceContainer serviceContainer, boolean createOnly)
public boolean unsetService(ServiceContainer serviceContainer, boolean unregisterInScope)
public int getServiceSize()
public IPropertyBlock getConfigurationPropertyBlock()
IChannelgetConfigurationPropertyBlock in interface IChannel<T>IPropertyBlock of queue for configuration detailspublic IPropertyBlock getStatePropertyBlock()
IChannelgetStatePropertyBlock in interface IChannel<T>IPropertyBlock of queue for work stateprotected int cleanDoneTasks()
protected long getDueTasks(List<TaskContainer> dueTaskList)
protected long getNextRun()
public IPropertyBlock getTaskPropertyBlock(String id)
IChannelIChannelTask scheduled under registration idgetTaskPropertyBlock in interface IChannel<T>id - registration-id for IChannelTaskIChannelTask scheduled under registration idpublic String scheduleTask(IChannelTask task)
IChannelIChannelTask to IChannel
equivalent to scheduleTask(null,task, null, -1, -1, -1);scheduleTask in interface IChannel<T>task - IChannelTask to schedulepublic String scheduleTask(String id, IChannelTask task)
IChannelIChannelTask to IChannel.scheduleTask in interface IChannel<T>id - registration-id for IChannelTask to scheduletask - IChannelTask to schedulepublic String scheduleTask(String id, IChannelTask task, IPropertyBlock propertyBlock, long executionTimeStamp, long timeOutValue, long heartBeatTimeOut)
IChannelIChannelTask to IChannel.scheduleTask in interface IChannel<T>id - registration-id for IChannelTask to scheduletask - IChannelTask to schedulepropertyBlock - IChannelTask-properties (factory in IMessageDispatcher)executionTimeStamp - execution time millistimeOutValue - timeout value in ms, before notify for timeoutheartBeatTimeOut - heartbeat-timeout value in ms, before notify for timeoutpublic String scheduleTask(String id, IChannelTask task, IPropertyBlock propertyBlock, long executionTimeStamp, long timeOutValue, long heartBeatTimeOut, boolean stopOnTimeOut)
IChannelIChannelTask to IChannel.scheduleTask in interface IChannel<T>id - registration-id for IChannelTask to scheduletask - IChannelTask to schedulepropertyBlock - IChannelTask-properties (factory in IMessageDispatcher)executionTimeStamp - execution time millistimeOutValue - timeout value in ms, before notify for timeoutheartBeatTimeOut - heartbeat-timeout value in ms, before notify for timeoutstopOnTimeOut - stop unlinked worker-thread on timeout. This option is NOT necessary to create new worker running other tasks. Attention: can be dangerouspublic IChannelTask rescheduleTask(String id, long executionTimeStamp, long timeOutValue, long heartBeatTimeOut)
IChannelIChannelTask
The execution timestamp is ignored if current execution plan requires earlier execution in the future and was requested by trigger, tasks control and periodic service configuration
rescheduleTask in interface IChannel<T>id - registration-id of IChannelTask in which reset execution planexecutionTimeStamp - new execution time millistimeOutValue - new timeout value in ms, before notify for timeoutheartBeatTimeOut - heartbeat-timeout value in ms, before notify for timeoutIChannelTask or null if not foundpublic IChannelTask getTask(String id)
IChannelIChannelTask scheduled under registration idgetTask in interface IChannel<T>id - registration-id for IChannelTaskIChannelTask scheduled under registration idpublic IChannelTask removeTask(String id)
IChannelIChannelTask scheduled under registration idremoveTask in interface IChannel<T>id - registration-id for IChannelTask to removeIChannelTask or null if no scheduled with id foundpublic IMessage getMessage(String uuid)
IChannelIMessage queued with uuidgetMessage in interface IChannel<T>uuid - searchfilteruuid or null if not presentpublic DequeSnapshot<IMessage<T>> getMessageSnapshot()
IChannelgetMessageSnapshot in interface IChannel<T>public DequeSnapshot<IMessage<T>> getMessageSnapshotPoll()
IChannelgetMessageSnapshotPoll in interface IChannel<T>public void closeWorkerSnapshots()
protected boolean removeMessage(MessageImpl message)
public boolean removeMessage(String uuid)
IChannelIMessage queued with uuidremoveMessage in interface IChannel<T>uuid - identifier for IMessage to removeIMessage was found and remove, otherwise falsepublic boolean removeMessageList(List<String> uuidList)
IChannelIMessages queued with one of uuidsremoveMessageList in interface IChannel<T>uuidList - list of identifiers for IMessage to removeIMessage was found and remove, otherwise falsepublic List<ChannelManagerContainer> getControllerContainerList()
public List<ServiceContainer> getServiceList()
public boolean checkTimeOut()
public void dispose()
public void stopQueueWorker()
public MessageDispatcherImpl getEventDispatcher()
protected DequeSnapshot<String> getSignalsSnapshot()
protected DequeSnapshot<? extends IMessage> getNewScheduledEventsSnaphot()
protected DequeSnapshot<? extends IMessage> getRemovedEventsSnapshot()
protected void notifyOrCreateWorker(long nextRuntimeStamp)
protected boolean checkFreeWorker(ChannelWorker worker, long nextRun)
protected boolean checkWorkerShutdown(ChannelWorker worker)
public TaskContainer getCurrentRunningTask()
public IMessageDispatcher getDispatcher()
IChannelgetDispatcher in interface IChannel<T>IMessageDispatcherpublic void signal(String signal)
IChannelIChannelManager manage this IChannel and implements IOnChannelSignal will notify asynchronously by queueworker.public DequeSnapshot<IOnChannelAttach> getOnQueueAttachList()
public void addOnChannelAttach(IOnChannelAttach onChannelAttach)
public String getName()
public void setName(String name)
public void touchLastWorkerAction()
public long getLastWorkerAction()
public ChannelConfigurationModifyListener getQueueConfigurationModifyListener()
public void setQueueConfigurationModifyListener(ChannelConfigurationModifyListener queueConfigurationModifyListener)
public ISubChannel createChildScope(UUID scopeId, String scopeName, ISubChannel parentScope, Map<String,Object> configurationProperties, Map<String,Object> stateProperties, boolean adoptContoller, boolean adoptServices)
IChannelISubChannel for IChannelcreateChildScope in interface IChannel<T>scopeId - unique id of scope (unique by queue) or null for auto-generationscopeName - human readable name of scope (nullable)parentScope - parent scope to define tree structure for scopesconfigurationProperties - blue print for configuration propertyblock of new scope (nullable)stateProperties - blue print for state propertyblock of new scope (nullable)adoptContoller - keep controller of parent queueadoptServices - keep services of parent queuepublic List<ISubChannel> getChildScopes()
IChannelgetChildScopes in interface IChannel<T>protected List<ISubChannel> getChildSessionScopes(UUID parentScopeId)
public ISubChannel getChildScope(UUID scopeId)
IChannelscopeIdgetChildScope in interface IChannel<T>scopeId - id of scope to returnscopeId or null, if scope not foundpublic int getEventListLimit()
public void setEventListLimit(int eventListLimit)
public IChannel getRootChannel()
IChannelgetRootChannel in interface IChannel<T>protected ReentrantLock getMessageEventLock()
public void recalcRegistrationTypes()
Copyright © 2020. All rights reserved.