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 Details

  • 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 request
      request - , the request
      time - , time expressed in long
      unit - , 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 request
      force - , 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.ScheduledRequest the request
    • clear

      public void clear()
      Clears all the scheduled requests