Class 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.

    • Method Detail

      • 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