Class ThreadAssocStore


  • public class ThreadAssocStore
    extends Object
    This singleton class is used to associated arbitrary objects with the current thread.

    It is a singleton to ensure static access from all corners of the application. It can be used as a crude way to communicate across methods in the same call stack.

    Simply think of it as a way to store thread-global object references. The content will be removed after the thread ends. If you need earlier release, just overwrite the values with a null.

    Do note that this class will purge the map from dead threads every minutes as long as threads are being added. This is done to prevent the held Threads from not being garbage-collected.

    Author:
    Martin Schroeder
    • Constructor Detail

      • ThreadAssocStore

        public ThreadAssocStore()
        Constructor used by the Extension annotation.

        You should not need to spawn a ThreadAssocStore yourself. Instead, use getInstance() to get the singleton.