T
- The monitored object.public class BlockingEventHandler<T> extends AbstractEventHandler<T>
Due to Guava Issue
786 handle(MonitorEvent)
is marked final
to avoid having duplicate
events.
Modifier and Type | Field and Description |
---|---|
protected List<T> |
lockedObjects
The objects being locked.
|
logger
Constructor and Description |
---|
BlockingEventHandler(Logger logger,
T... lockedObjects) |
BlockingEventHandler(T... lockedObjects) |
Modifier and Type | Method and Description |
---|---|
protected void |
doBeforeRelease(MonitorEvent<T> event)
Convenience method to bypass the Guava Issue 786 that
forces the subscriber method to be
final . |
void |
handle(MonitorEvent<T> event)
Handles the dispatched event in a thread safe way.
|
protected boolean |
handles(MonitorEvent<T> event)
Checks if the current handler must handle the dispatched event.
|
void |
lock()
Blocks the thread until all locked objects have been released.
|
protected void |
release(T target)
Releases the lock on the given object.
|
getLogger, setLogger
public BlockingEventHandler(T... lockedObjects)
protected boolean handles(MonitorEvent<T> event)
AbstractEventHandler
handles
in class AbstractEventHandler<T>
event
- The event being dispatched.public final void handle(MonitorEvent<T> event)
Due to Guava Issue
786 handle(MonitorEvent)
is marked final
to avoid having duplicate
events.
#doBeforeRelease(MonitorEvent)}
public void lock()
protected void release(T target)
protected void doBeforeRelease(MonitorEvent<T> event)
final
.Copyright © 2009-2013 jclouds. All Rights Reserved.