Interface StorageManager

  • All Known Implementing Classes:
    DefaultStorageManager

    public interface StorageManager
    Allows libraries to obtain custom-generated ThreadLocal instances for their storage.
    • Method Detail

      • instance

        static StorageManager instance()
        Returns the currently registered StorageManager
        Returns:
        the currently registered StorageManager
      • getThreadLocal

        <T extends StorageDeclaration<X>,​X> ThreadLocal<X> getThreadLocal​(Class<T> storageDeclarationClass)
        Obtains a ThreadLocal suitable for the given registered StorageDeclaration. The ThreadLocal may be a regular ThreadLocal, or one that this StorageManager manufactured for special dedicated storage. The returned ThreadLocal is cached and all subsequent calls to this method with the same storage declaration will always return the same ThreadLocal instance.
        Type Parameters:
        T - The StorageDeclaration type
        X - The type of data we store in that ThreadLocal
        Parameters:
        storageDeclarationClass - the declaration class which defines the type of item we want to store in the required ThreadLocal
        Returns:
        the ThreadLocal, memoized
      • threadLocal

        static <T extends StorageDeclaration<X>,​X> ThreadLocal<X> threadLocal​(Class<T> storageDeclarationClass)
        Obtains a ThreadLocal suitable for the given registered StorageDeclaration. The ThreadLocal may be a regular ThreadLocal, or one that this StorageManager manufactured for special dedicated storage. The returned ThreadLocal is cached and all subsequent calls to this method with the same storage declaration will always return the same ThreadLocal instance.
        Type Parameters:
        T - The StorageDeclaration type
        X - The type of data we store in that ThreadLocal
        Parameters:
        storageDeclarationClass - the declaration class which defines the type of item we want to store in the required ThreadLocal
        Returns:
        the ThreadLocal, memoized