Class TopicSubscriptionManager
- java.lang.Object
-
- org.camunda.bpm.client.topic.impl.TopicSubscriptionManager
-
- All Implemented Interfaces:
java.lang.Runnable
public class TopicSubscriptionManager extends java.lang.Object implements java.lang.Runnable
- Author:
- Tassilo Weidner
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.concurrent.locks.ReentrantLock
ACQUISITION_MONITOR
protected BackoffStrategy
backoffStrategy
protected long
clientLockDuration
protected EngineClient
engineClient
protected java.util.Map<java.lang.String,ExternalTaskHandler>
externalTaskHandlers
protected ExternalTaskServiceImpl
externalTaskService
protected java.util.concurrent.locks.Condition
IS_WAITING
protected java.util.concurrent.atomic.AtomicBoolean
isBackoffStrategyDisabled
protected java.util.concurrent.atomic.AtomicBoolean
isRunning
protected static TopicSubscriptionManagerLogger
LOG
protected java.util.concurrent.CopyOnWriteArrayList<TopicSubscription>
subscriptions
protected java.util.List<TopicRequestDto>
taskTopicRequests
protected java.lang.Thread
thread
protected TypedValues
typedValues
-
Constructor Summary
Constructors Constructor Description TopicSubscriptionManager(EngineClient engineClient, TypedValues typedValues, long clientLockDuration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
acquire()
void
disableBackoffStrategy()
protected FetchAndLockResponseDto
fetchAndLock(java.util.List<TopicRequestDto> subscriptions)
EngineClient
getEngineClient()
java.util.List<TopicSubscription>
getSubscriptions()
protected void
handleExternalTask(ExternalTask externalTask, ExternalTaskHandler taskHandler)
boolean
isRunning()
protected void
prepareAcquisition(TopicSubscription subscription)
protected void
resume()
void
run()
protected void
runBackoffStrategy(FetchAndLockResponseDto fetchAndLockResponse)
void
setBackoffStrategy(BackoffStrategy backOffStrategy)
void
start()
void
stop()
protected void
subscribe(TopicSubscription subscription)
protected void
suspend(long waitTime)
protected void
unsubscribe(TopicSubscriptionImpl subscription)
-
-
-
Field Detail
-
LOG
protected static final TopicSubscriptionManagerLogger LOG
-
ACQUISITION_MONITOR
protected java.util.concurrent.locks.ReentrantLock ACQUISITION_MONITOR
-
IS_WAITING
protected java.util.concurrent.locks.Condition IS_WAITING
-
isRunning
protected java.util.concurrent.atomic.AtomicBoolean isRunning
-
externalTaskService
protected ExternalTaskServiceImpl externalTaskService
-
engineClient
protected EngineClient engineClient
-
subscriptions
protected java.util.concurrent.CopyOnWriteArrayList<TopicSubscription> subscriptions
-
taskTopicRequests
protected java.util.List<TopicRequestDto> taskTopicRequests
-
externalTaskHandlers
protected java.util.Map<java.lang.String,ExternalTaskHandler> externalTaskHandlers
-
thread
protected java.lang.Thread thread
-
backoffStrategy
protected BackoffStrategy backoffStrategy
-
isBackoffStrategyDisabled
protected java.util.concurrent.atomic.AtomicBoolean isBackoffStrategyDisabled
-
typedValues
protected TypedValues typedValues
-
clientLockDuration
protected long clientLockDuration
-
-
Constructor Detail
-
TopicSubscriptionManager
public TopicSubscriptionManager(EngineClient engineClient, TypedValues typedValues, long clientLockDuration)
-
-
Method Detail
-
run
public void run()
- Specified by:
run
in interfacejava.lang.Runnable
-
acquire
protected void acquire()
-
prepareAcquisition
protected void prepareAcquisition(TopicSubscription subscription)
-
fetchAndLock
protected FetchAndLockResponseDto fetchAndLock(java.util.List<TopicRequestDto> subscriptions)
-
handleExternalTask
protected void handleExternalTask(ExternalTask externalTask, ExternalTaskHandler taskHandler)
-
stop
public void stop()
-
start
public void start()
-
subscribe
protected void subscribe(TopicSubscription subscription)
-
unsubscribe
protected void unsubscribe(TopicSubscriptionImpl subscription)
-
getEngineClient
public EngineClient getEngineClient()
-
getSubscriptions
public java.util.List<TopicSubscription> getSubscriptions()
-
isRunning
public boolean isRunning()
-
setBackoffStrategy
public void setBackoffStrategy(BackoffStrategy backOffStrategy)
-
runBackoffStrategy
protected void runBackoffStrategy(FetchAndLockResponseDto fetchAndLockResponse)
-
suspend
protected void suspend(long waitTime)
-
resume
protected void resume()
-
disableBackoffStrategy
public void disableBackoffStrategy()
-
-