Package javax.jmdns.impl
Interface DNSStatefulObject
- All Known Implementing Classes:
DNSStatefulObject.DefaultImplementation
,HostInfo
,HostInfo.HostInfoState
,JmDNSImpl
,ServiceInfoImpl
,ServiceInfoImpl.ServiceInfoState
public interface DNSStatefulObject
Sets of methods to manage the state machine.
Implementation note: This interface is accessed from multiple threads. The implementation must be thread safe.
Implementation note: This interface is accessed from multiple threads. The implementation must be thread safe.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class
static final class
This class define a semaphore. -
Method Summary
Modifier and TypeMethodDescriptionboolean
advanceState
(DNSTask task) Sets the state and notifies all objects that wait on the ServiceInfo.void
associateWithTask
(DNSTask task, DNSState state) Sets the task associated with this Object.boolean
Sets the state and notifies all objects that wait on the ServiceInfo.boolean
Sets the state and notifies all objects that wait on the ServiceInfo.getDns()
Returns the DNS associated with this object.boolean
Returns true, if this is an announced state.boolean
Returns true, if this is an announcing state.boolean
isAssociatedWithTask
(DNSTask task, DNSState state) Checks if this object is associated with the task and in the same state.boolean
Returns true, if this is a canceled state.boolean
Returns true, if this is a canceling state.boolean
isClosed()
Returns true, if this is a closed state.boolean
Returns true, if this is a closing state.boolean
Returns true, if this is a probing state.boolean
Sets the state and notifies all objects that wait on the ServiceInfo.void
Remove the association of the task with this Object.boolean
Sets the state and notifies all objects that wait on the ServiceInfo.boolean
waitForAnnounced
(long timeout) Waits for the object to be announced.boolean
waitForCanceled
(long timeout) Waits for the object to be canceled.
-
Method Details
-
getDns
JmDNSImpl getDns()Returns the DNS associated with this object.- Returns:
- DNS resolver
-
associateWithTask
Sets the task associated with this Object.- Parameters:
task
- associated taskstate
- state of the task
-
removeAssociationWithTask
Remove the association of the task with this Object.- Parameters:
task
- associated task
-
isAssociatedWithTask
Checks if this object is associated with the task and in the same state.- Parameters:
task
- associated taskstate
- state of the task- Returns:
true
is the task is associated with this object,false
otherwise.
-
advanceState
Sets the state and notifies all objects that wait on the ServiceInfo.- Parameters:
task
- associated task- Returns:
true
if the state was changed by this thread,false
otherwise.- See Also:
-
revertState
boolean revertState()Sets the state and notifies all objects that wait on the ServiceInfo.- Returns:
true
if the state was changed by this thread,false
otherwise.- See Also:
-
cancelState
boolean cancelState()Sets the state and notifies all objects that wait on the ServiceInfo.- Returns:
true
if the state was changed by this thread,false
otherwise.
-
closeState
boolean closeState()Sets the state and notifies all objects that wait on the ServiceInfo.- Returns:
true
if the state was changed by this thread,false
otherwise.
-
recoverState
boolean recoverState()Sets the state and notifies all objects that wait on the ServiceInfo.- Returns:
true
if the state was changed by this thread,false
otherwise.
-
isProbing
boolean isProbing()Returns true, if this is a probing state.- Returns:
true
if probing state,false
otherwise
-
isAnnouncing
boolean isAnnouncing()Returns true, if this is an announcing state.- Returns:
true
if announcing state,false
otherwise
-
isAnnounced
boolean isAnnounced()Returns true, if this is an announced state.- Returns:
true
if announced state,false
otherwise
-
isCanceling
boolean isCanceling()Returns true, if this is a canceling state.- Returns:
true
if canceling state,false
otherwise
-
isCanceled
boolean isCanceled()Returns true, if this is a canceled state.- Returns:
true
if canceled state,false
otherwise
-
isClosing
boolean isClosing()Returns true, if this is a closing state.- Returns:
true
if closing state,false
otherwise
-
isClosed
boolean isClosed()Returns true, if this is a closed state.- Returns:
true
if closed state,false
otherwise
-
waitForAnnounced
boolean waitForAnnounced(long timeout) Waits for the object to be announced.- Parameters:
timeout
- the maximum time to wait in milliseconds.- Returns:
true
if the object is announced,false
otherwise
-
waitForCanceled
boolean waitForCanceled(long timeout) Waits for the object to be canceled.- Parameters:
timeout
- the maximum time to wait in milliseconds.- Returns:
true
if the object is canceled,false
otherwise
-