public interface Synchronizer
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
SYNCHRONIZER |
Modifier and Type | Method and Description |
---|---|
long |
clear(java.lang.String lockName)
Clear one lock.
|
long |
getCount(java.lang.String lockName)
Get the number of notifications issued for the specified lock
|
boolean |
getRendezVous(java.lang.String lockName,
long timeoutMs)
Wait until a rendez-vous is complete, i.e.
|
void |
notify(java.lang.String lockName)
Notify the specified lock, incrementing a notification counter.
|
void |
reset()
Clear all locks supported by this synchronizer.
|
void |
setRendezVous(java.lang.String lockName,
long count)
Set a rendez-vous for a given lock, setting the minimum
number of notifications that must be reached to complete
the rendez-vous.
|
void |
wait(java.lang.String lockName)
Wait until the specified lock is notified at least once.
|
boolean |
wait(java.lang.String lockName,
long timeout_ms)
Wait until the specified lock is notified at least once,
or the specified time out is reached
|
boolean |
wait(java.lang.String lockName,
long timeout_ms,
long occurrences)
Wait until the specified lock is notified at least the specified
number of times, or the specified time out is reached
|
boolean |
wasNotified(java.lang.String lockName)
Test if a lock has been notified at least once
|
boolean |
wasNotified(java.lang.String lockName,
long occurrences)
Test if a lock has been notified at least the specified
number of times.
|
static final java.lang.String SYNCHRONIZER
void setRendezVous(java.lang.String lockName, long count)
lockName
- the lock namecount
- the minimum number of notifications to wait forboolean getRendezVous(java.lang.String lockName, long timeoutMs) throws java.lang.InterruptedException, java.lang.IllegalArgumentException
lockName
- the lock nametimeoutMs
- time out in ms. 0 means infinite time out.
A negative value is not acceptable.java.lang.InterruptedException
- if any thread interrupted the current
thread before or while the current thread was waiting for a notificationjava.lang.IllegalArgumentException
- if the value of timeout is negative.void wait(java.lang.String lockName) throws java.lang.InterruptedException
lockName
- the lock namejava.lang.InterruptedException
- the current thread has been interrupted
while waiting for the lock notification, causing this method to exit
with no lock notification.boolean wait(java.lang.String lockName, long timeout_ms) throws java.lang.InterruptedException, java.lang.IllegalArgumentException
lockName
- the lock nametimeout_ms
- time out in ms. 0 means infinite time out.
A negative value is not acceptable.java.lang.InterruptedException
- if any thread interrupted the current
thread before or while the current thread was waiting for a notificationjava.lang.IllegalArgumentException
- if the value of timeout is negative.boolean wait(java.lang.String lockName, long timeout_ms, long occurrences) throws java.lang.InterruptedException, java.lang.IllegalArgumentException
lockName
- the lock nametimeout_ms
- time out in ms. 0 means infinite time out.
A negative value is not acceptable.occurrences
- the minimum number of notifications to wait forjava.lang.InterruptedException
- if any thread interrupted the current
thread before or while the current thread was waiting for a notificationjava.lang.IllegalArgumentException
- if the value of timeout is negative.void notify(java.lang.String lockName)
lockName
- the lock nameboolean wasNotified(java.lang.String lockName)
lockName
- the lock nameboolean wasNotified(java.lang.String lockName, long occurrences)
lockName
- the lock nameoccurrences
- the minimum number of notificationslong getCount(java.lang.String lockName)
lockName
- the lock namevoid reset()
long clear(java.lang.String lockName)
lockName
- the lock name