/** * This method will ensure the notification is intimated to the listeners of the same type. * * @param notification Notification to be notified. * @param <T> Type of notification. */ @Synchronized public <T extends Notification> void notify(final T notification) { String type = notification.getClass().getSimpleName(); map.get(type).forEach(l -> { log.info("Executing listener of type: {} for notification: {}", type, notification); ExecutorServiceHelpers.execute(() -> l.getListener().onNotification(notification), throwable -> log.error("Exception while executing listener for notification: {}", notification), () -> log.info("Completed execution of notify for notification :{}", notification), l.getExecutor()); }); }
ExecutorServiceHelpers.execute( runCount::incrementAndGet, exceptionHolder::set, exceptionHolder.set(null); finallyCount.set(0); ExecutorServiceHelpers.execute( () -> { throw new IntentionalException(); AssertExtensions.assertThrows( "execute did not throw appropriate exception when executor was closed", () -> ExecutorServiceHelpers.execute( runCount::incrementAndGet, exceptionHolder::set,