core/src/com/google/inject/internal/InjectorImpl.java
InternalContext enterContext() {
    Object[] reference = localContext.get();
    if (reference == null) {
      reference = new Object[1];
      localContext.set(reference);
    }
    InternalContext ctx = (InternalContext) reference[0];
    if (ctx == null) {
      reference[0] = ctx = new InternalContext(options, reference);
    } else {
      ctx.enter();
    }
    return ctx;
  }
InternalContext enterContext() {
    Object[] reference = localContext.get();
    if (reference == null) {
      reference = new Object[1];
      localContext.set(reference);
    }
    InternalContext ctx = (InternalContext) reference[0];
    if (ctx == null) {
      reference[0] = ctx = new InternalContext(options, reference);
    } else {
      ctx.enter();
    }
    return ctx;
  }
Looks up thread local context and {@link InternalContext#enter() enters} it or creates a new
context if necessary.

<p>All callers of this are responsible for calling {@link InternalContext#close()}. Typical
usage should look like:

<pre>{@code
InternalContext ctx = injector.enterContext();
try {
... use ctx ...
} finally {
ctx.close();
}
}</pre>