Exit a block of code requiring a Context. Calling exit() will remove the association between the current thread and a Context if the prior call to ContextFactory#enterContext() on this thread newly associated a Context with this thread. Once the current thread no longer has an as
()
| 502 | * @see ContextFactory#enterContext() |
| 503 | */ |
| 504 | public static void exit() { |
| 505 | Context cx = currentContext.get(); |
| 506 | if (cx == null) { |
| 507 | throw new IllegalStateException("Calling Context.exit without previous Context.enter"); |
| 508 | } |
| 509 | if (cx.enterCount < 1) Kit.codeBug(); |
| 510 | if (--cx.enterCount == 0) { |
| 511 | releaseContext(cx); |
| 512 | } |
| 513 | } |
| 514 | |
| 515 | @Override |
| 516 | public void close() { |