public class FetchAndLockHandlerImpl extends Object implements Runnable, FetchAndLockHandler
| Modifier and Type | Field and Description |
|---|---|
protected SingleConsumerCondition |
condition |
protected Thread |
handlerThread |
protected boolean |
isRunning |
protected boolean |
isUniqueWorkerRequest |
protected static long |
MAX_BACK_OFF_TIME |
protected static long |
MAX_REQUEST_TIMEOUT |
protected List<FetchAndLockRequest> |
newRequests |
protected static long |
PENDING_REQUEST_FETCH_INTERVAL |
protected List<FetchAndLockRequest> |
pendingRequests |
protected BlockingQueue<FetchAndLockRequest> |
queue |
protected static String |
UNIQUE_WORKER_REQUEST_PARAM_NAME |
| Constructor and Description |
|---|
FetchAndLockHandlerImpl() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
acquire() |
void |
addPendingRequest(FetchExternalTasksExtendedDto dto,
javax.ws.rs.container.AsyncResponse asyncResponse,
ProcessEngine processEngine)
Invoked if a fetch and lock request has been sent by the client
|
protected void |
addRequest(FetchAndLockRequest request) |
void |
contextInitialized(javax.servlet.ServletContextEvent servletContextEvent)
Invoked on initialization of the servlet context
|
protected void |
errorTooManyRequests(javax.ws.rs.container.AsyncResponse asyncResponse) |
protected List<LockedExternalTaskDto> |
executeFetchAndLock(FetchExternalTasksExtendedDto fetchingDto,
ProcessEngine processEngine) |
List<FetchAndLockRequest> |
getPendingRequests() |
protected ProcessEngine |
getProcessEngine(FetchAndLockRequest request) |
protected boolean |
isExpired(FetchAndLockRequest request) |
protected void |
parseUniqueWorkerRequestParam(String uniqueWorkerRequestParam) |
protected void |
rejectPendingRequests() |
protected void |
removeDuplicates() |
void |
run() |
void |
shutdown()
Receives a notification that the engine rest web application is about to be shut down
|
void |
start()
Receives a notification that the engine rest web application initialization has been started
|
protected void |
suspend(long millis) |
protected void |
suspendAcquisition(long millis) |
protected FetchAndLockResult |
tryFetchAndLock(FetchAndLockRequest request) |
protected static final String UNIQUE_WORKER_REQUEST_PARAM_NAME
protected static final long PENDING_REQUEST_FETCH_INTERVAL
protected static final long MAX_BACK_OFF_TIME
protected static final long MAX_REQUEST_TIMEOUT
protected SingleConsumerCondition condition
protected BlockingQueue<FetchAndLockRequest> queue
protected List<FetchAndLockRequest> pendingRequests
protected List<FetchAndLockRequest> newRequests
protected Thread handlerThread
protected volatile boolean isRunning
protected boolean isUniqueWorkerRequest
protected void acquire()
protected void removeDuplicates()
public void start()
FetchAndLockHandlerstart in interface FetchAndLockHandlerpublic void shutdown()
FetchAndLockHandlershutdown in interface FetchAndLockHandlerprotected void suspend(long millis)
protected void suspendAcquisition(long millis)
protected void addRequest(FetchAndLockRequest request)
protected FetchAndLockResult tryFetchAndLock(FetchAndLockRequest request)
protected List<LockedExternalTaskDto> executeFetchAndLock(FetchExternalTasksExtendedDto fetchingDto, ProcessEngine processEngine)
protected void errorTooManyRequests(javax.ws.rs.container.AsyncResponse asyncResponse)
protected void rejectPendingRequests()
protected ProcessEngine getProcessEngine(FetchAndLockRequest request)
protected boolean isExpired(FetchAndLockRequest request)
public void addPendingRequest(FetchExternalTasksExtendedDto dto, javax.ws.rs.container.AsyncResponse asyncResponse, ProcessEngine processEngine)
FetchAndLockHandleraddPendingRequest in interface FetchAndLockHandlerdto - which is supposed to hold the payloadasyncResponse - provides means for asynchronous server side response processingprocessEngine - provides the process engine context of the respective requestpublic void contextInitialized(javax.servlet.ServletContextEvent servletContextEvent)
FetchAndLockHandlercontextInitialized in interface FetchAndLockHandlerservletContextEvent - provides the servlet contextprotected void parseUniqueWorkerRequestParam(String uniqueWorkerRequestParam)
public List<FetchAndLockRequest> getPendingRequests()
Copyright © 2021. All rights reserved.