/** Gets the context for the given event. */ private SubscriberExceptionContext context(Object event) { return new SubscriberExceptionContext(bus, event, target, method); }
/** Gets the context for the given event. */ private SubscriberExceptionContext context(Object event) { return new SubscriberExceptionContext(bus, event, target, method); }
/** Gets the context for the given event. */ private SubscriberExceptionContext context(Object event) { return new SubscriberExceptionContext(bus, event, target, method); }
SubscriberExceptionContext toContext() { return new SubscriberExceptionContext(eventBus, new Object(), this, subscriberMethod()); }
/** Gets the context for the given event. */ private SubscriberExceptionContext context(Object event) { return new SubscriberExceptionContext(bus, event, target, method); }
/** Gets the context for the given event. */ private SubscriberExceptionContext context(Object event) { return new SubscriberExceptionContext(bus, event, target, method); }
/** * Dispatches {@code event} to the subscriber in {@code wrapper}. This method * is an appropriate override point for subclasses that wish to make * event delivery asynchronous. * * @param event event to dispatch. * @param wrapper wrapper that will call the subscriber. */ void dispatch(Object event, EventSubscriber wrapper) { try { wrapper.handleEvent(event); } catch (InvocationTargetException e) { try { subscriberExceptionHandler.handleException( e.getCause(), new SubscriberExceptionContext( this, event, wrapper.getSubscriber(), wrapper.getMethod())); } catch (Throwable t) { // If the exception handler throws, log it. There isn't much else to do! Logger.getLogger(EventBus.class.getName()).log(Level.SEVERE, String.format( "Exception %s thrown while handling exception: %s", t, e.getCause()), t); } } }
SubscriberExceptionContext toContext() { return new SubscriberExceptionContext(eventBus, new Object(), this, subscriberMethod()); }
/** * Dispatches {@code event} to the subscriber in {@code wrapper}. This method * is an appropriate override point for subclasses that wish to make * event delivery asynchronous. * * @param event event to dispatch. * @param wrapper wrapper that will call the subscriber. */ void dispatch(Object event, EventSubscriber wrapper) { try { wrapper.handleEvent(event); } catch (InvocationTargetException e) { try { subscriberExceptionHandler.handleException( e.getCause(), new SubscriberExceptionContext( this, event, wrapper.getSubscriber(), wrapper.getMethod())); } catch (Throwable t) { // If the exception handler throws, log it. There isn't much else to do! Logger.getLogger(EventBus.class.getName()).log(Level.SEVERE, String.format( "Exception %s thrown while handling exception: %s", t, e.getCause()), t); } } }