Class WeakReferenceThreadMap<V>

java.lang.Object
org.apache.hadoop.util.WeakReferenceMap<Long,V>
org.apache.hadoop.fs.impl.WeakReferenceThreadMap<V>
Type Parameters:
V - value type of the map

public class WeakReferenceThreadMap<V> extends WeakReferenceMap<Long,V>
A WeakReferenceMap for threads.
  • Constructor Details

    • WeakReferenceThreadMap

      public WeakReferenceThreadMap(Function<? super Long,? extends V> factory, @Nullable Consumer<? super Long> referenceLost)
  • Method Details

    • getForCurrentThread

      public V getForCurrentThread()
      Get the value for the current thread, creating if needed.
      Returns:
      an instance.
    • removeForCurrentThread

      public V removeForCurrentThread()
      Remove the reference for the current thread.
      Returns:
      any reference value which existed.
    • currentThreadId

      public long currentThreadId()
      Get the current thread ID.
      Returns:
      thread ID.
    • setForCurrentThread

      public V setForCurrentThread(V newVal)
      Set the new value for the current thread.
      Parameters:
      newVal - new reference to set for the active thread.
      Returns:
      the previously set value, possibly null