Package org.infinispan.lock.impl.lock
Class RequestExpirationScheduler
- java.lang.Object
-
- org.infinispan.lock.impl.lock.RequestExpirationScheduler
-
public class RequestExpirationScheduler extends Object
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
Constructors Constructor Description RequestExpirationScheduler(ScheduledExecutorService scheduledExecutorService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabortScheduling(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 requestsintcountScheduledRequests()Returns the size of the currently scheduled requestsorg.infinispan.lock.impl.lock.RequestExpirationScheduler.ScheduledRequestget(String requestId)Get scheduled request reference by id if such existvoidscheduleForCompletion(String requestId, CompletableFuture<Boolean> request, long time, TimeUnit unit)Schedules a request for completion
-
-
-
Constructor Detail
-
RequestExpirationScheduler
public RequestExpirationScheduler(ScheduledExecutorService scheduledExecutorService)
-
-
Method Detail
-
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
public void abortScheduling(String requestId)
Aborts the scheduled request if the request is already completed- Parameters:
requestId- , unique identifier of the request
-
abortScheduling
public void abortScheduling(String requestId, boolean force)
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
-
-