Class DeadlineChecker

java.lang.Object
com.google.gerrit.server.DeadlineChecker
All Implemented Interfaces:
com.google.gerrit.server.cancellation.RequestStateProvider

public class DeadlineChecker extends Object implements com.google.gerrit.server.cancellation.RequestStateProvider
RequestStateProvider that checks whether a client provided deadline is exceeded.

Should be registered at most once per request.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
     

    Nested classes/interfaces inherited from interface com.google.gerrit.server.cancellation.RequestStateProvider

    com.google.gerrit.server.cancellation.RequestStateProvider.OnCancelled, com.google.gerrit.server.cancellation.RequestStateProvider.Reason
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    checkIfCancelled(com.google.gerrit.server.cancellation.RequestStateProvider.OnCancelled onCancelled)
     
    Creates a formatter that formats a timeout as <TIMEOUT_NAME>=<TIMEOUT><TIME_UNIT>.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getTimeoutFormatter

      public static Function<Long,String> getTimeoutFormatter(String timeoutName)
      Creates a formatter that formats a timeout as <TIMEOUT_NAME>=<TIMEOUT><TIME_UNIT>.

      If the timeout is 1 minute or greater, minutes is used as a time unit. Otherwise milliseconds is just as a time unit.

      Parameters:
      timeoutName - the name of the timeout
    • checkIfCancelled

      public void checkIfCancelled(com.google.gerrit.server.cancellation.RequestStateProvider.OnCancelled onCancelled)
      Specified by:
      checkIfCancelled in interface com.google.gerrit.server.cancellation.RequestStateProvider