Constructor and Description |
---|
Event(String name,
ExceptionChainer<T> chainer)
Creates this event with given
name and exception chainer . |
Event(String name,
ExceptionChainer<T> chainer,
ReentrantLock lock)
Creates this event with given
name , exception chainer , and associated lock . |
Modifier and Type | Method and Description |
---|---|
void |
await()
Await this event to have a definite
true or false value. |
void |
await(long timeout,
TimeUnit unit)
Await this event to have a definite
true or false value, for timeout duration. |
void |
clear()
Clear this event.
|
void |
deliverError(Throwable t)
Deliver the error
t (after chaining) to any present or future waiters. |
boolean |
hasWaiters() |
boolean |
inError() |
boolean |
isSet() |
void |
lock()
Acquire the lock associated with this event.
|
void |
set()
Sets this event to be
true . |
String |
toString() |
boolean |
tryAwait(long timeout,
TimeUnit unit)
Await this event to have a definite
true or false value, for timeout duration. |
void |
unlock()
Release the lock associated with this event.
|
public Event(String name, ExceptionChainer<T> chainer)
name
and exception chainer
. Allocates a new Lock
object for this event.name
- name of this eventchainer
- ExceptionChainer
that will be used for chaining exceptionspublic Event(String name, ExceptionChainer<T> chainer, ReentrantLock lock)
name
, exception chainer
, and associated lock
.name
- name of this eventchainer
- ExceptionChainer
that will be used for chaining exceptionslock
- lock to usepublic void set()
true
. Short for set(true)
.public void clear()
!isSet()
.public void deliverError(Throwable t)
t
(after chaining) to any present or future waiters.public boolean isSet()
set()
or deliverError(java.lang.Throwable)
public void await() throws T extends Throwable
true
or false
value.public void await(long timeout, TimeUnit unit) throws T extends Throwable
true
or false
value, for timeout
duration.public boolean tryAwait(long timeout, TimeUnit unit) throws T extends Throwable
true
or false
value, for timeout
duration.
If the definite value is not available when the timeout expires, returns false
.public boolean hasWaiters()
public boolean inError()
public void lock()
public void unlock()
Copyright © 2009-2012. All Rights Reserved.