Package javax.jmdns.impl
Class DNSStatefulObject.DefaultImplementation
java.lang.Object
java.util.concurrent.locks.ReentrantLock
javax.jmdns.impl.DNSStatefulObject.DefaultImplementation
- All Implemented Interfaces:
Serializable,Lock,DNSStatefulObject
- Direct Known Subclasses:
HostInfo.HostInfoState,ServiceInfoImpl.ServiceInfoState
- Enclosing interface:
DNSStatefulObject
public static class DNSStatefulObject.DefaultImplementation
extends ReentrantLock
implements DNSStatefulObject
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface javax.jmdns.impl.DNSStatefulObject
DNSStatefulObject.DefaultImplementation, DNSStatefulObject.DNSStatefulObjectSemaphore -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DNSStatefulObject.DNSStatefulObjectSemaphoreprivate final DNSStatefulObject.DNSStatefulObjectSemaphoreprivate JmDNSImplprotected DNSStateprotected DNSTaskprivate static org.slf4j.Loggerprivate static final long -
Constructor Summary
Constructors -
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.protected voidprotected voidprotected voidtoString()booleanwaitForAnnounced(long timeout) Waits for the object to be announced.booleanwaitForCanceled(long timeout) Waits for the object to be canceled.private booleanprivate booleanMethods inherited from class java.util.concurrent.locks.ReentrantLock
getHoldCount, getOwner, getQueuedThreads, getQueueLength, getWaitingThreads, getWaitQueueLength, hasQueuedThread, hasQueuedThreads, hasWaiters, isFair, isHeldByCurrentThread, isLocked, lock, lockInterruptibly, newCondition, tryLock, tryLock, unlock
-
Field Details
-
logger
private static org.slf4j.Logger logger -
serialVersionUID
private static final long serialVersionUID- See Also:
-
_dns
-
_task
-
_state
-
_announcing
-
_canceling
-
-
Constructor Details
-
DefaultImplementation
public DefaultImplementation()
-
-
Method Details
-
getDns
Returns the DNS associated with this object.- Specified by:
getDnsin interfaceDNSStatefulObject- Returns:
- DNS resolver
-
setDns
-
associateWithTask
Sets the task associated with this Object.- Specified by:
associateWithTaskin interfaceDNSStatefulObject- Parameters:
task- associated taskstate- state of the task
-
removeAssociationWithTask
Remove the association of the task with this Object.- Specified by:
removeAssociationWithTaskin interfaceDNSStatefulObject- Parameters:
task- associated task
-
isAssociatedWithTask
Checks if this object is associated with the task and in the same state.- Specified by:
isAssociatedWithTaskin interfaceDNSStatefulObject- Parameters:
task- associated taskstate- state of the task- Returns:
trueis the task is associated with this object,falseotherwise.
-
setTask
-
setState
- Parameters:
state- the state to set
-
advanceState
Sets the state and notifies all objects that wait on the ServiceInfo.- Specified by:
advanceStatein interfaceDNSStatefulObject- Parameters:
task- associated task- Returns:
trueif the state was changed by this thread,falseotherwise.- See Also:
-
revertState
public boolean revertState()Sets the state and notifies all objects that wait on the ServiceInfo.- Specified by:
revertStatein interfaceDNSStatefulObject- Returns:
trueif the state was changed by this thread,falseotherwise.- See Also:
-
cancelState
public boolean cancelState()Sets the state and notifies all objects that wait on the ServiceInfo.- Specified by:
cancelStatein interfaceDNSStatefulObject- Returns:
trueif the state was changed by this thread,falseotherwise.
-
closeState
public boolean closeState()Sets the state and notifies all objects that wait on the ServiceInfo.- Specified by:
closeStatein interfaceDNSStatefulObject- Returns:
trueif the state was changed by this thread,falseotherwise.
-
recoverState
public boolean recoverState()Sets the state and notifies all objects that wait on the ServiceInfo.- Specified by:
recoverStatein interfaceDNSStatefulObject- Returns:
trueif the state was changed by this thread,falseotherwise.
-
isProbing
public boolean isProbing()Returns true, if this is a probing state.- Specified by:
isProbingin interfaceDNSStatefulObject- Returns:
trueif probing state,falseotherwise
-
isAnnouncing
public boolean isAnnouncing()Returns true, if this is an announcing state.- Specified by:
isAnnouncingin interfaceDNSStatefulObject- Returns:
trueif announcing state,falseotherwise
-
isAnnounced
public boolean isAnnounced()Returns true, if this is an announced state.- Specified by:
isAnnouncedin interfaceDNSStatefulObject- Returns:
trueif announced state,falseotherwise
-
isCanceling
public boolean isCanceling()Returns true, if this is a canceling state.- Specified by:
isCancelingin interfaceDNSStatefulObject- Returns:
trueif canceling state,falseotherwise
-
isCanceled
public boolean isCanceled()Returns true, if this is a canceled state.- Specified by:
isCanceledin interfaceDNSStatefulObject- Returns:
trueif canceled state,falseotherwise
-
isClosing
public boolean isClosing()Returns true, if this is a closing state.- Specified by:
isClosingin interfaceDNSStatefulObject- Returns:
trueif closing state,falseotherwise
-
isClosed
public boolean isClosed()Returns true, if this is a closed state.- Specified by:
isClosedin interfaceDNSStatefulObject- Returns:
trueif closed state,falseotherwise
-
willCancel
private boolean willCancel() -
willClose
private boolean willClose() -
waitForAnnounced
public boolean waitForAnnounced(long timeout) Waits for the object to be announced.- Specified by:
waitForAnnouncedin interfaceDNSStatefulObject- Parameters:
timeout- the maximum time to wait in milliseconds.- Returns:
trueif the object is announced,falseotherwise
-
waitForCanceled
public boolean waitForCanceled(long timeout) Waits for the object to be canceled.- Specified by:
waitForCanceledin interfaceDNSStatefulObject- Parameters:
timeout- the maximum time to wait in milliseconds.- Returns:
trueif the object is canceled,falseotherwise
-
toString
- Overrides:
toStringin classReentrantLock
-