Package javax.jmdns.impl
Class DNSStatefulObject.DNSStatefulObjectSemaphore
java.lang.Object
javax.jmdns.impl.DNSStatefulObject.DNSStatefulObjectSemaphore
- Enclosing interface:
DNSStatefulObject
This class define a semaphore. On this multiple threads can wait the arrival of one event. Thread wait for a maximum defined by the timeout.
Implementation note: this class is based on Semaphore
so that they can be released by the timeout timer.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final String
private final ConcurrentMap
<Thread, Semaphore> private static org.slf4j.Logger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Signals the semaphore when the event arrives.toString()
void
waitForEvent
(long timeout) Blocks the current thread until the event arrives or the timeout expires.
-
Field Details
-
logger
private static org.slf4j.Logger logger -
_name
-
_semaphores
-
-
Constructor Details
-
DNSStatefulObjectSemaphore
- Parameters:
name
- Semaphore name for debugging purposes.
-
-
Method Details
-
waitForEvent
public void waitForEvent(long timeout) Blocks the current thread until the event arrives or the timeout expires.- Parameters:
timeout
- wait period for the event
-
signalEvent
public void signalEvent()Signals the semaphore when the event arrives. -
toString
-