public static class DNSStatefulObject.DefaultImplementation extends ReentrantLock implements DNSStatefulObject
DNSStatefulObject.DefaultImplementation, DNSStatefulObject.DNSStatefulObjectSemaphore
Modifier and Type | Field and Description |
---|---|
protected DNSState |
_state |
protected DNSTask |
_task |
Constructor and Description |
---|
DefaultImplementation() |
Modifier and Type | Method and Description |
---|---|
boolean |
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 |
cancelState()
Sets the state and notifies all objects that wait on the ServiceInfo.
|
boolean |
closeState()
Sets the state and notifies all objects that wait on the ServiceInfo.
|
JmDNSImpl |
getDns()
Returns the DNS associated with this object.
|
boolean |
isAnnounced()
Returns true, if this is an announced state.
|
boolean |
isAnnouncing()
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 |
isCanceled()
Returns true, if this is a canceled state.
|
boolean |
isCanceling()
Returns true, if this is a canceling state.
|
boolean |
isClosed()
Returns true, if this is a closed state.
|
boolean |
isClosing()
Returns true, if this is a closing state.
|
boolean |
isProbing()
Returns true, if this is a probing state.
|
boolean |
recoverState()
Sets the state and notifies all objects that wait on the ServiceInfo.
|
void |
removeAssociationWithTask(DNSTask task)
Remove the association of the task with this Object.
|
boolean |
revertState()
Sets the state and notifies all objects that wait on the ServiceInfo.
|
protected void |
setDns(JmDNSImpl dns) |
protected void |
setState(DNSState state) |
protected void |
setTask(DNSTask task) |
String |
toString() |
boolean |
waitForAnnounced(long timeout)
Waits for the object to be announced.
|
boolean |
waitForCanceled(long timeout)
Waits for the object to be canceled.
|
getHoldCount, getOwner, getQueuedThreads, getQueueLength, getWaitingThreads, getWaitQueueLength, hasQueuedThread, hasQueuedThreads, hasWaiters, isFair, isHeldByCurrentThread, isLocked, lock, lockInterruptibly, newCondition, tryLock, tryLock, unlock
public JmDNSImpl getDns()
getDns
in interface DNSStatefulObject
protected void setDns(JmDNSImpl dns)
public void associateWithTask(DNSTask task, DNSState state)
associateWithTask
in interface DNSStatefulObject
task
- associated taskstate
- state of the taskpublic void removeAssociationWithTask(DNSTask task)
removeAssociationWithTask
in interface DNSStatefulObject
task
- associated taskpublic boolean isAssociatedWithTask(DNSTask task, DNSState state)
isAssociatedWithTask
in interface DNSStatefulObject
task
- associated taskstate
- state of the tasktrue
is the task is associated with this object, false
otherwise.protected void setTask(DNSTask task)
protected void setState(DNSState state)
state
- the state to setpublic boolean advanceState(DNSTask task)
advanceState
in interface DNSStatefulObject
task
- associated tasktrue
false otherwise.DNSState.advance()
public boolean revertState()
revertState
in interface DNSStatefulObject
true
false otherwise.DNSState.revert()
public boolean cancelState()
cancelState
in interface DNSStatefulObject
true
false otherwise.public boolean closeState()
closeState
in interface DNSStatefulObject
true
false otherwise.public boolean recoverState()
recoverState
in interface DNSStatefulObject
true
false otherwise.public boolean isProbing()
isProbing
in interface DNSStatefulObject
true
if probing state, false
otherwisepublic boolean isAnnouncing()
isAnnouncing
in interface DNSStatefulObject
true
if announcing state, false
otherwisepublic boolean isAnnounced()
isAnnounced
in interface DNSStatefulObject
true
if announced state, false
otherwisepublic boolean isCanceling()
isCanceling
in interface DNSStatefulObject
true
if canceling state, false
otherwisepublic boolean isCanceled()
isCanceled
in interface DNSStatefulObject
true
if canceled state, false
otherwisepublic boolean isClosing()
isClosing
in interface DNSStatefulObject
true
if closing state, false
otherwisepublic boolean isClosed()
isClosed
in interface DNSStatefulObject
true
if closed state, false
otherwisepublic boolean waitForAnnounced(long timeout)
waitForAnnounced
in interface DNSStatefulObject
timeout
- the maximum time to wait in milliseconds.true
if the object is announced, false
otherwisepublic boolean waitForCanceled(long timeout)
waitForCanceled
in interface DNSStatefulObject
timeout
- the maximum time to wait in milliseconds.true
if the object is canceled, false
otherwisepublic String toString()
toString
in class ReentrantLock
Copyright © 2002–2019 JmDNS. All rights reserved.