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 classstatic final classThis class define a semaphore. -
Method Summary
Modifier and TypeMethodDescriptionbooleanadvanceState(DNSTask task) Sets the state and notifies all objects that wait on the ServiceInfo.voidassociateWithTask(DNSTask task, DNSState state) Sets the task associated with this Object.booleanSets the state and notifies all objects that wait on the ServiceInfo.booleanSets the state and notifies all objects that wait on the ServiceInfo.getDns()Returns the DNS associated with this object.booleanReturns true, if this is an announced state.booleanReturns true, if this is an announcing state.booleanisAssociatedWithTask(DNSTask task, DNSState state) Checks if this object is associated with the task and in the same state.booleanReturns true, if this is a canceled state.booleanReturns true, if this is a canceling state.booleanisClosed()Returns true, if this is a closed state.booleanReturns true, if this is a closing state.booleanReturns true, if this is a probing state.booleanSets the state and notifies all objects that wait on the ServiceInfo.voidRemove the association of the task with this Object.booleanSets the state and notifies all objects that wait on the ServiceInfo.booleanwaitForAnnounced(long timeout) Waits for the object to be announced.booleanwaitForCanceled(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:
trueis the task is associated with this object,falseotherwise.
-
advanceState
Sets the state and notifies all objects that wait on the ServiceInfo.- Parameters:
task- associated task- Returns:
trueif the state was changed by this thread,falseotherwise.- See Also:
-
revertState
boolean revertState()Sets the state and notifies all objects that wait on the ServiceInfo.- Returns:
trueif the state was changed by this thread,falseotherwise.- See Also:
-
cancelState
boolean cancelState()Sets the state and notifies all objects that wait on the ServiceInfo.- Returns:
trueif the state was changed by this thread,falseotherwise.
-
closeState
boolean closeState()Sets the state and notifies all objects that wait on the ServiceInfo.- Returns:
trueif the state was changed by this thread,falseotherwise.
-
recoverState
boolean recoverState()Sets the state and notifies all objects that wait on the ServiceInfo.- Returns:
trueif the state was changed by this thread,falseotherwise.
-
isProbing
boolean isProbing()Returns true, if this is a probing state.- Returns:
trueif probing state,falseotherwise
-
isAnnouncing
boolean isAnnouncing()Returns true, if this is an announcing state.- Returns:
trueif announcing state,falseotherwise
-
isAnnounced
boolean isAnnounced()Returns true, if this is an announced state.- Returns:
trueif announced state,falseotherwise
-
isCanceling
boolean isCanceling()Returns true, if this is a canceling state.- Returns:
trueif canceling state,falseotherwise
-
isCanceled
boolean isCanceled()Returns true, if this is a canceled state.- Returns:
trueif canceled state,falseotherwise
-
isClosing
boolean isClosing()Returns true, if this is a closing state.- Returns:
trueif closing state,falseotherwise
-
isClosed
boolean isClosed()Returns true, if this is a closed state.- Returns:
trueif closed state,falseotherwise
-
waitForAnnounced
boolean waitForAnnounced(long timeout) Waits for the object to be announced.- Parameters:
timeout- the maximum time to wait in milliseconds.- Returns:
trueif the object is announced,falseotherwise
-
waitForCanceled
boolean waitForCanceled(long timeout) Waits for the object to be canceled.- Parameters:
timeout- the maximum time to wait in milliseconds.- Returns:
trueif the object is canceled,falseotherwise
-