Class Timer


  • public class Timer
    extends Object
    The Timer acts as the main timing facility for various operations, for example to track and time out requests if they run for too long.
    Since:
    2.0.0
    • Method Detail

      • create

        public static Timer create()
        Creates a new Timer with default values.
        Returns:
        the created timer.
      • createAndStart

        public static Timer createAndStart()
        Creates and starts a timer with default values.
        Returns:
        the created and started timer.
      • schedule

        @Internal
        public com.couchbase.client.core.deps.io.netty.util.Timeout schedule​(Runnable callback,
                                                                             Duration runAfter)
        Schedule an arbitrary task for this timer.
      • register

        @Internal
        public void register​(Request<Response> request)
        Registers the given request to be tracked with its timeout value.
        Parameters:
        request - the request to track.
      • scheduledTasks

        public long scheduledTasks()
        Returns the number of currently scheduled tasks.
        Returns:
        the number of scheduled tasks.
      • start

        public void start()
        Starts this timer.
      • stop

        public void stop()
        Stops this timer.