@Override public T get() { final Thread thread = Thread.currentThread(); final Fiber fiber = Fiber.currentFiber(); if (fiber != null) fiber.restoreThreadLocals(thread); try { return super.get(); } finally { if (fiber != null) fiber.installFiberLocals(thread); } }
@Override public void set(T value) { final Thread thread = Thread.currentThread(); final Fiber fiber = Fiber.currentFiber(); if (fiber != null) fiber.restoreThreadLocals(thread); try { super.set(value); } finally { if (fiber != null) fiber.installFiberLocals(thread); } } }
private void restoreThreadData(Thread currentThread, Object old) { record(1, "Fiber", "restoreThreadData", "%s <-> %s", this, currentThread); if (!noLocals) { restoreThreadLocals(currentThread); restoreThreadContextClassLoader(currentThread); if (MAINTAIN_ACCESS_CONTROL_CONTEXT) restoreThreadInheritedAccessControlContext(currentThread); } setCurrentTarget(old, currentThread); }
throw t; } finally { restoreThreadLocals(); setCurrentFiber(null);