@Test public void shouldNotInterfereWithoutValidation() { CloseChecker.onOpen(RESOURCE_ID, OWNER_ID); }
public static synchronized void onOpen(final String resourceId, final Object owner) { if (CLOSE_CHECKER_ENABLED) { try { throw new Exception(); } catch (final Exception e) { final Resource resource = RESOURCES.computeIfAbsent( resourceId, (key) -> new Resource()); final Exception oldException = resource.currentlyOpen.put(owner, e); if (oldException != null) { final Error error = error(resourceId, owner); error.addSuppressed(oldException); throw error; } } } }
CloseChecker { public static synchronized void onOpen(final String resourceId, final Object owner) { if (CLOSE_CHECKER_ENABLED) { try { throw new Exception(); } catch (final Exception e) { final Resource resource = RESOURCES.computeIfAbsent( resourceId, (key) -> new Resource()); final Exception oldException = resource.currentlyOpen.put(owner, e); if (oldException != null) { final Error error = error(resourceId, owner); error.addSuppressed(oldException); throw error; } } } } }
CloseChecker { public static synchronized void onOpen(final String resourceId, final Object owner) { if (CLOSE_CHECKER_ENABLED) { try { throw new Exception(); } catch (final Exception e) { final Resource resource = RESOURCES.computeIfAbsent( resourceId, (key) -> new Resource()); final Exception oldException = resource.currentlyOpen.put(owner, e); if (oldException != null) { final Error error = error(resourceId, owner); error.addSuppressed(oldException); throw error; } } } }  }
CloseChecker { public static synchronized void onOpen(final String resourceId, final Object owner) { if (CLOSE_CHECKER_ENABLED) { try { throw new Exception(); } catch (final Exception e) { final Resource resource = RESOURCES.computeIfAbsent( resourceId, (key) -> new Resource()); final Exception oldException = resource.currentlyOpen.put(owner, e); if (oldException != null) { final Error error = error(resourceId, owner); error.addSuppressed(oldException); throw error; } } } }  static synchronized void onOpen(final String resourceId, final Object owner); static synchronized void onClose(final String resourceId, final Object owner); static synchronized void validate(final String resourceId); }
CloseChecker { public static synchronized void onOpen(final String resourceId, final Object owner) { if (CLOSE_CHECKER_ENABLED) { try { throw new Exception(); } catch (final Exception e) { final Resource resource = RESOURCES.computeIfAbsent( resourceId, (key) -> new Resource()); final Exception oldException = resource.currentlyOpen.put(owner, e); if (oldException != null) { final Error error = error(resourceId, owner); error.addSuppressed(oldException); throw error; } } } }  static synchronized void onOpen(final String resourceId, final Object owner); static synchronized void onClose(final String resourceId, final Object owner); static synchronized void validate(final String resourceId);  }