Package org.infinispan.lock.impl.lock
Class RequestExpirationScheduler
java.lang.Object
org.infinispan.lock.impl.lock.RequestExpirationScheduler
This class holds the logic to schedule/abort requests that need to be completed at a given time.
- Since:
- 9.2
- Author:
- Katia Aresti, karesti@redhat.com
-
Constructor Summary
ConstructorsConstructorDescriptionRequestExpirationScheduler(ScheduledExecutorService scheduledExecutorService) -
Method Summary
Modifier and TypeMethodDescriptionvoidabortScheduling(String requestId) Aborts the scheduled request if the request is already completedvoidabortScheduling(String requestId, boolean force) Aborts the scheduled request.voidclear()Clears all the scheduled requestsintReturns the size of the currently scheduled requestsorg.infinispan.lock.impl.lock.RequestExpirationScheduler.ScheduledRequestGet scheduled request reference by id if such existvoidscheduleForCompletion(String requestId, CompletableFuture<Boolean> request, long time, TimeUnit unit) Schedules a request for completion
-
Constructor Details
-
RequestExpirationScheduler
-
-
Method Details
-
scheduleForCompletion
public void scheduleForCompletion(String requestId, CompletableFuture<Boolean> request, long time, TimeUnit unit) Schedules a request for completion- Parameters:
requestId- , the unique identifier if the requestrequest- , the requesttime- , time expressed in longunit- ,TimeUnit
-
abortScheduling
Aborts the scheduled request if the request is already completed- Parameters:
requestId- , unique identifier of the request
-
abortScheduling
Aborts the scheduled request. If force is true, it will abort even if the request is not completed- Parameters:
requestId- , unique identifier of the requestforce- , force abort
-
countScheduledRequests
public int countScheduledRequests()Returns the size of the currently scheduled requests- Returns:
- the number of requests that are pending on the scheduler
-
get
public org.infinispan.lock.impl.lock.RequestExpirationScheduler.ScheduledRequest get(String requestId) Get scheduled request reference by id if such exist- Parameters:
requestId- , the id of the scheduled request- Returns:
RequestExpirationScheduler.ScheduledRequestthe request
-
clear
public void clear()Clears all the scheduled requests
-