public class FetchAndLockHandlerImpl extends Object implements Runnable, FetchAndLockHandler
Modifier and Type | Field and Description |
---|---|
protected Thread |
handlerThread |
protected static Condition |
IS_EXTERNAL_TASK_AVAILABLE |
protected boolean |
isRunning |
protected boolean |
isWaiting |
protected static ReentrantLock |
LOCK_MONITOR |
protected static long |
MAX_BACK_OFF_TIME |
protected static long |
MAX_TIMEOUT |
protected List<FetchAndLockRequest> |
pendingRequests |
protected BlockingQueue<FetchAndLockRequest> |
queue |
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) |
protected void |
errorTooManyRequests(javax.ws.rs.container.AsyncResponse asyncResponse) |
protected List<LockedExternalTaskDto> |
executeFetchAndLock(FetchExternalTasksExtendedDto fetchingDto,
ProcessEngine processEngine) |
List<FetchAndLockRequest> |
getPendingRequests() |
protected void |
invalidRequest(javax.ws.rs.container.AsyncResponse asyncResponse,
String message) |
protected void |
notifyAcquisition() |
protected void |
rejectPendingRequests() |
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 ReentrantLock LOCK_MONITOR
protected static final Condition IS_EXTERNAL_TASK_AVAILABLE
protected static final long MAX_BACK_OFF_TIME
protected static final long MAX_TIMEOUT
protected BlockingQueue<FetchAndLockRequest> queue
protected List<FetchAndLockRequest> pendingRequests
protected Thread handlerThread
protected boolean isWaiting
protected boolean isRunning
protected void acquire()
public void start()
FetchAndLockHandler
start
in interface FetchAndLockHandler
public void shutdown()
FetchAndLockHandler
shutdown
in interface FetchAndLockHandler
protected void suspend(long millis)
protected void suspendAcquisition(long millis)
protected void addRequest(FetchAndLockRequest request)
protected void notifyAcquisition()
protected FetchAndLockResult tryFetchAndLock(FetchAndLockRequest request)
protected List<LockedExternalTaskDto> executeFetchAndLock(FetchExternalTasksExtendedDto fetchingDto, ProcessEngine processEngine)
protected void invalidRequest(javax.ws.rs.container.AsyncResponse asyncResponse, String message)
protected void errorTooManyRequests(javax.ws.rs.container.AsyncResponse asyncResponse)
protected void rejectPendingRequests()
public void addPendingRequest(FetchExternalTasksExtendedDto dto, javax.ws.rs.container.AsyncResponse asyncResponse, ProcessEngine processEngine)
FetchAndLockHandler
addPendingRequest
in interface FetchAndLockHandler
dto
- which is supposed to hold the payloadasyncResponse
- provides means for asynchronous server side response processingprocessEngine
- provides the process engine context of the respective requestpublic List<FetchAndLockRequest> getPendingRequests()
Copyright © 2018. All rights reserved.