All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.undefinedlabs.scope.context.ThreadLocalContextStorage Maven / Gradle / Ivy

package com.undefinedlabs.scope.context;

final class ThreadLocalContextStorage extends ImmutableContext.Storage {

  /** Currently bound context. */
  private static final ThreadLocal localContext =
      new ThreadLocal();

  @Override
  public void attach(ImmutableContext toAttach) {
    localContext.set(toAttach);
  }

  @Override
  public void detach(ImmutableContext toDetach, ImmutableContext toRestore) {
    attach(toRestore);
  }

  @Override
  public ImmutableContext current() {
    return localContext.get();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy