class Subscriber extends Object
Two subscribers are equivalent when they refer to the same method on the same object (not class). This property is used to ensure that no subscriber method is registered more than once.
| Modifier and Type | Class and Description |
|---|---|
(package private) static class |
Subscriber.SynchronizedSubscriber
Subscriber that synchronizes invocations of a method to ensure that only one thread may enter
the method at a time.
|
| Modifier and Type | Field and Description |
|---|---|
private EventBus |
bus
The event bus this subscriber belongs to.
|
private Executor |
executor
Executor to use for dispatching events to this subscriber.
|
private Method |
method
Subscriber method.
|
(package private) Object |
target
The object with the subscriber method.
|
| Modifier | Constructor and Description |
|---|---|
private |
Subscriber(EventBus bus,
Object target,
Method method) |
| Modifier and Type | Method and Description |
|---|---|
private SubscriberExceptionContext |
context(Object event)
Gets the context for the given event.
|
(package private) static Subscriber |
create(EventBus bus,
Object listener,
Method method)
Creates a
Subscriber for method on listener. |
(package private) void |
dispatchEvent(Object event)
Dispatches
event to this subscriber using the proper executor. |
boolean |
equals(Object obj) |
int |
hashCode() |
(package private) void |
invokeSubscriberMethod(Object event)
Invokes the subscriber method.
|
private static boolean |
isDeclaredThreadSafe(Method method)
Checks whether
method is thread-safe, as indicated by the presence of the AllowConcurrentEvents annotation. |
private Subscriber(EventBus bus, Object target, Method method)
static Subscriber create(EventBus bus, Object listener, Method method)
Subscriber for method on listener.bus - event buslistener - listenermethod - methodfinal void dispatchEvent(Object event)
event to this subscriber using the proper executor.event - event to dispatchvoid invokeSubscriberMethod(Object event) throws InvocationTargetException
event - event to dispatchInvocationTargetException - if the invocation failsprivate SubscriberExceptionContext context(Object event)
event - eventprivate static boolean isDeclaredThreadSafe(Method method)
method is thread-safe, as indicated by the presence of the AllowConcurrentEvents annotation.method - method to checktrue if method is thread-safe