Package org.camunda.bpm.engine.rest.impl
Class FetchAndLockHandlerImpl
java.lang.Object
org.camunda.bpm.engine.rest.impl.FetchAndLockHandlerImpl
- All Implemented Interfaces:
Runnable
,FetchAndLockHandler
- Author:
- Tassilo Weidner
-
Field Summary
Modifier and TypeFieldDescriptionprotected SingleConsumerCondition
protected Thread
protected boolean
protected boolean
protected static final long
protected static final long
protected List<FetchAndLockRequest>
protected static final long
protected List<FetchAndLockRequest>
protected BlockingQueue<FetchAndLockRequest>
protected static final String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
acquire()
void
addPendingRequest
(FetchExternalTasksExtendedDto dto, jakarta.ws.rs.container.AsyncResponse asyncResponse, ProcessEngine processEngine) Invoked if a fetch and lock request has been sent by the clientprotected void
addRequest
(FetchAndLockRequest request) void
contextInitialized
(jakarta.servlet.ServletContextEvent servletContextEvent) Invoked on initialization of the servlet contextprotected void
errorTooManyRequests
(jakarta.ws.rs.container.AsyncResponse asyncResponse) protected List<LockedExternalTaskDto>
executeFetchAndLock
(FetchExternalTasksExtendedDto fetchingDto, ProcessEngine processEngine) protected ProcessEngine
getProcessEngine
(FetchAndLockRequest request) protected boolean
isExpired
(FetchAndLockRequest request) protected void
parseUniqueWorkerRequestParam
(String uniqueWorkerRequestParam) protected void
protected void
void
run()
void
shutdown()
Receives a notification that the engine rest web application is about to be shut downvoid
start()
Receives a notification that the engine rest web application initialization has been startedprotected void
suspend
(long millis) protected void
suspendAcquisition
(long millis) protected FetchAndLockResult
tryFetchAndLock
(FetchAndLockRequest request)
-
Field Details
-
UNIQUE_WORKER_REQUEST_PARAM_NAME
- See Also:
-
PENDING_REQUEST_FETCH_INTERVAL
protected static final long PENDING_REQUEST_FETCH_INTERVAL- See Also:
-
MAX_BACK_OFF_TIME
protected static final long MAX_BACK_OFF_TIME- See Also:
-
MAX_REQUEST_TIMEOUT
protected static final long MAX_REQUEST_TIMEOUT- See Also:
-
condition
-
queue
-
pendingRequests
-
newRequests
-
handlerThread
-
isRunning
protected volatile boolean isRunning -
isUniqueWorkerRequest
protected boolean isUniqueWorkerRequest
-
-
Constructor Details
-
FetchAndLockHandlerImpl
public FetchAndLockHandlerImpl()
-
-
Method Details
-
run
public void run() -
acquire
protected void acquire() -
removeDuplicates
protected void removeDuplicates() -
start
public void start()Description copied from interface:FetchAndLockHandler
Receives a notification that the engine rest web application initialization has been started- Specified by:
start
in interfaceFetchAndLockHandler
-
shutdown
public void shutdown()Description copied from interface:FetchAndLockHandler
Receives a notification that the engine rest web application is about to be shut down- Specified by:
shutdown
in interfaceFetchAndLockHandler
-
suspend
protected void suspend(long millis) -
suspendAcquisition
protected void suspendAcquisition(long millis) -
addRequest
-
tryFetchAndLock
-
executeFetchAndLock
protected List<LockedExternalTaskDto> executeFetchAndLock(FetchExternalTasksExtendedDto fetchingDto, ProcessEngine processEngine) -
errorTooManyRequests
protected void errorTooManyRequests(jakarta.ws.rs.container.AsyncResponse asyncResponse) -
rejectPendingRequests
protected void rejectPendingRequests() -
getProcessEngine
-
isExpired
-
addPendingRequest
public void addPendingRequest(FetchExternalTasksExtendedDto dto, jakarta.ws.rs.container.AsyncResponse asyncResponse, ProcessEngine processEngine) Description copied from interface:FetchAndLockHandler
Invoked if a fetch and lock request has been sent by the client- Specified by:
addPendingRequest
in interfaceFetchAndLockHandler
- Parameters:
dto
- which is supposed to hold the payloadasyncResponse
- provides means for asynchronous server side response processingprocessEngine
- provides the process engine context of the respective request
-
contextInitialized
public void contextInitialized(jakarta.servlet.ServletContextEvent servletContextEvent) Description copied from interface:FetchAndLockHandler
Invoked on initialization of the servlet context- Specified by:
contextInitialized
in interfaceFetchAndLockHandler
- Parameters:
servletContextEvent
- provides the servlet context
-
parseUniqueWorkerRequestParam
-
getPendingRequests
-