org.apache.solr.search

## Class SolrQueryTimeoutImpl

- java.lang.Object
- - org.apache.solr.search.SolrQueryTimeoutImpl

- All Implemented Interfaces:
    QueryTimeout

      public class SolrQueryTimeoutImpl
      extends Object
      implements QueryTimeout

  Implementation of `QueryTimeout` that is used by Solr. It uses a ThreadLocal variable to track the timeoutAt value for each request thread.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static ThreadLocal<Long>` | `timeoutAt` The ThreadLocal variable to store the time beyond which, the processing should exit.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Long` | `get()` Get the current value of timeoutAt.
    `static SolrQueryTimeoutImpl` | `getInstance()` Return singleton instance
    `boolean` | `isTimeoutEnabled()`
    `static void` | `reset()` Cleanup the ThreadLocal timeout value.
    `static void` | `set(Long timeAllowed)` Method to set the time at which the timeOut should happen.
    `boolean` | `shouldExit()` Return true if a timeoutAt value is set and the current time has exceeded the set timeOut.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### timeoutAt

          public static ThreadLocal<Long> timeoutAt

      The ThreadLocal variable to store the time beyond which, the processing should exit.

  - ### Method Detail

    - #### getInstance

          public static SolrQueryTimeoutImpl getInstance()

      Return singleton instance

    - #### get

          public static Long get()

      Get the current value of timeoutAt.

    - #### isTimeoutEnabled

          public boolean isTimeoutEnabled()

      Specified by:
        `isTimeoutEnabled` in interface `QueryTimeout`

    - #### shouldExit

          public boolean shouldExit()

      Return true if a timeoutAt value is set and the current time has exceeded the set timeOut.
      Specified by:
        `shouldExit` in interface `QueryTimeout`

    - #### set

          public static void set(Long timeAllowed)

      Method to set the time at which the timeOut should happen.
      Parameters:
        `timeAllowed` - set the time at which this thread should timeout.

    - #### reset

          public static void reset()

      Cleanup the ThreadLocal timeout value.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.