Schnittstelle ThreadLocalStorage

Alle bekannten Implementierungsklassen:
ThreadLocalStorageImpl

public interface ThreadLocalStorage
Provides a service which can temporarily store thread-local data. This is useful in a multithreaded environment, such as a servlet or Tapestry application. ThreadLocalStorage acts like a map around thread local data. The code was pasted from the Hivemind container written by Howard Lewis Ship.
Autor:
Siegfried Goeschl
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    void
    Clears all keys.
    boolean
    Checks if the thread-local object for the given key exists
    get(String key)
    Returns the thread-local object for the given key, or null if no such object exists.
    void
    put(String key, Object value)
    Stores the value object at the given key, overwriting any prior value that may have been stored at that key.
  • Methodendetails

    • get

      Object get(String key)
      Returns the thread-local object for the given key, or null if no such object exists.
      Parameter:
      key - the key for the lookup
      Gibt zurück:
      the object
    • put

      void put(String key, Object value)
      Stores the value object at the given key, overwriting any prior value that may have been stored at that key. Care should be taken in selecting keys to avoid naming conflicts; in general, prefixing a key with a module id is a good idea.
      Parameter:
      key - the key of the object to store
      value - the value of the object to store
    • containsKey

      boolean containsKey(String key)
      Checks if the thread-local object for the given key exists
      Parameter:
      key - the key for the lookup
      Gibt zurück:
      true the object exists
    • clear

      void clear()
      Clears all keys.