Class ListenerTimeouts

org.elasticsearch.action.support.ListenerTimeouts

public class ListenerTimeouts extends
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <Response> ActionListener<Response>
    wrapWithTimeout​(ThreadPool threadPool, ActionListener<Response> listener, org.elasticsearch.core.TimeValue timeout,  executor,  listenerName)
    Wraps a listener with a listener that can timeout.
    static <Response> ActionListener<Response>
    wrapWithTimeout​(ThreadPool threadPool, org.elasticsearch.core.TimeValue timeout,  executor, ActionListener<Response> listener, <ActionListener<Response>> onTimeout)
    Wraps a listener with a listener that can timeout.

    Methods inherited from class java.lang.

    , , , , , , , , , ,
  • Constructor Details

    • ListenerTimeouts

      public ListenerTimeouts()
  • Method Details

    • wrapWithTimeout

      public static <Response> ActionListener<Response> wrapWithTimeout(ThreadPool threadPool, ActionListener<Response> listener, org.elasticsearch.core.TimeValue timeout,  executor,  listenerName)
      Wraps a listener with a listener that can timeout. After the timeout period the ActionListener.onFailure(Exception) will be called with a ElasticsearchTimeoutException if the listener has not already been completed.
      Parameters:
      threadPool - used to schedule the timeout
      listener - to that can timeout
      timeout - period before listener failed
      executor - to use for scheduling timeout
      listenerName - name of the listener for timeout exception
      Returns:
      the wrapped listener that will timeout
    • wrapWithTimeout

      public static <Response> ActionListener<Response> wrapWithTimeout(ThreadPool threadPool, org.elasticsearch.core.TimeValue timeout,  executor, ActionListener<Response> listener, <ActionListener<Response>> onTimeout)
      Wraps a listener with a listener that can timeout. After the timeout period the onTimeout Runnable will be called.
      Parameters:
      threadPool - used to schedule the timeout
      timeout - period before listener failed
      executor - to use for scheduling timeout
      listener - to that can timeout
      onTimeout - consumer will be called and the resulting wrapper will be passed to it as a parameter
      Returns:
      the wrapped listener that will timeout