Package javax.jmdns.impl
Class DNSStatefulObject.DNSStatefulObjectSemaphore
- java.lang.Object
-
- javax.jmdns.impl.DNSStatefulObject.DNSStatefulObjectSemaphore
-
- Enclosing interface:
- DNSStatefulObject
public static final class DNSStatefulObject.DNSStatefulObjectSemaphore extends java.lang.ObjectThis 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
Semaphoreso that they can be released by the timeout timer.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String_nameprivate java.util.concurrent.ConcurrentMap<java.lang.Thread,java.util.concurrent.Semaphore>_semaphoresprivate static org.slf4j.Loggerlogger
-
Constructor Summary
Constructors Constructor Description DNSStatefulObjectSemaphore(java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidsignalEvent()Signals the semaphore when the event arrives.java.lang.StringtoString()voidwaitForEvent(long timeout)Blocks the current thread until the event arrives or the timeout expires.
-
-
-
Method Detail
-
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
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-