Class Timeout.Builder

    • Method Detail

      • build

        public Timeout build()
        Description copied from interface: Builder
        Build the instance from this builder.
        Specified by:
        build in interface Builder<Timeout>
        Returns:
        instance of the built type
      • timeout

        public Timeout.Builder timeout​(Duration timeout)
        Timeout duration.
        Parameters:
        timeout - duration of the timeout of operations handled by the new Timeout instance
        Returns:
        updated builder instance
      • currentThread

        public Timeout.Builder currentThread​(boolean currentThread)
        Flag to indicate that code must be executed in current thread instead of in an executor's thread. This flag is false by default.
        Parameters:
        currentThread - setting for this timeout
        Returns:
        updated builder instance
      • executor

        public Timeout.Builder executor​(ScheduledExecutorService executor)
        Executor service to schedule the timeout.
        Parameters:
        executor - scheduled executor service to use
        Returns:
        updated builder instance
      • name

        public Timeout.Builder name​(String name)
        A name assigned for debugging, error reporting or configuration purposes.
        Parameters:
        name - the name
        Returns:
        updated builder instance
      • cancelSource

        public Timeout.Builder cancelSource​(boolean cancelSource)
        Cancel source if destination stage is cancelled.
        Parameters:
        cancelSource - setting for cancel source, defaults (@code true}
        Returns:
        updated builder instance
      • config

        public Timeout.Builder config​(Config config)

        Load all properties for this circuit breaker from configuration.

        Configuration
        key default value description
        timeout 10 seconds Length of timeout
        current-thread false Control that task is executed in calling thread
        name Timeout-N Name used for debugging
        cancel-source true Cancel task source if task is cancelled
        Parameters:
        config - the config node to use
        Returns:
        updated builder instance