JmDNS 3.4.1

javax.jmdns.impl
Class DNSStatefulObject.DefaultImplementation

java.lang.Object
  extended by java.util.concurrent.locks.ReentrantLock
      extended by javax.jmdns.impl.DNSStatefulObject.DefaultImplementation
All Implemented Interfaces:
Serializable, Lock, DNSStatefulObject
Enclosing interface:
DNSStatefulObject

public static class DNSStatefulObject.DefaultImplementation
extends ReentrantLock
implements DNSStatefulObject

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface javax.jmdns.impl.DNSStatefulObject
DNSStatefulObject.DefaultImplementation, DNSStatefulObject.DNSStatefulObjectSemaphore
 
Field Summary
protected  DNSState _state
           
protected  DNSTask _task
           
 
Constructor Summary
DNSStatefulObject.DefaultImplementation()
           
 
Method Summary
 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.
 
Methods 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_task

protected volatile DNSTask _task

_state

protected volatile DNSState _state
Constructor Detail

DNSStatefulObject.DefaultImplementation

public DNSStatefulObject.DefaultImplementation()
Method Detail

getDns

public JmDNSImpl getDns()
Returns the DNS associated with this object.

Specified by:
getDns in interface DNSStatefulObject
Returns:
DNS resolver

setDns

protected void setDns(JmDNSImpl dns)

associateWithTask

public void associateWithTask(DNSTask task,
                              DNSState state)
Sets the task associated with this Object.

Specified by:
associateWithTask in interface DNSStatefulObject
Parameters:
task - associated task
state - state of the task

removeAssociationWithTask

public void removeAssociationWithTask(DNSTask task)
Remove the association of the task with this Object.

Specified by:
removeAssociationWithTask in interface DNSStatefulObject
Parameters:
task - associated task

isAssociatedWithTask

public boolean isAssociatedWithTask(DNSTask task,
                                    DNSState state)
Checks if this object is associated with the task and in the same state.

Specified by:
isAssociatedWithTask in interface DNSStatefulObject
Parameters:
task - associated task
state - state of the task
Returns:
true is the task is associated with this object, false otherwise.

setTask

protected void setTask(DNSTask task)

setState

protected void setState(DNSState state)
Parameters:
state - the state to set

advanceState

public boolean advanceState(DNSTask task)
Sets the state and notifies all objects that wait on the ServiceInfo.

Specified by:
advanceState in interface DNSStatefulObject
Parameters:
task - associated task
Returns:
truefalse otherwise.
See Also:
DNSState.advance()

revertState

public boolean revertState()
Sets the state and notifies all objects that wait on the ServiceInfo.

Specified by:
revertState in interface DNSStatefulObject
Returns:
truefalse otherwise.
See Also:
DNSState.revert()

cancelState

public boolean cancelState()
Sets the state and notifies all objects that wait on the ServiceInfo.

Specified by:
cancelState in interface DNSStatefulObject
Returns:
truefalse otherwise.

closeState

public boolean closeState()
Sets the state and notifies all objects that wait on the ServiceInfo.

Specified by:
closeState in interface DNSStatefulObject
Returns:
truefalse otherwise.

recoverState

public boolean recoverState()
Sets the state and notifies all objects that wait on the ServiceInfo.

Specified by:
recoverState in interface DNSStatefulObject
Returns:
truefalse otherwise.

isProbing

public boolean isProbing()
Returns true, if this is a probing state.

Specified by:
isProbing in interface DNSStatefulObject
Returns:
true if probing state, false otherwise

isAnnouncing

public boolean isAnnouncing()
Returns true, if this is an announcing state.

Specified by:
isAnnouncing in interface DNSStatefulObject
Returns:
true if announcing state, false otherwise

isAnnounced

public boolean isAnnounced()
Returns true, if this is an announced state.

Specified by:
isAnnounced in interface DNSStatefulObject
Returns:
true if announced state, false otherwise

isCanceling

public boolean isCanceling()
Returns true, if this is a canceling state.

Specified by:
isCanceling in interface DNSStatefulObject
Returns:
true if canceling state, false otherwise

isCanceled

public boolean isCanceled()
Returns true, if this is a canceled state.

Specified by:
isCanceled in interface DNSStatefulObject
Returns:
true if canceled state, false otherwise

isClosing

public boolean isClosing()
Returns true, if this is a closing state.

Specified by:
isClosing in interface DNSStatefulObject
Returns:
true if closing state, false otherwise

isClosed

public boolean isClosed()
Returns true, if this is a closed state.

Specified by:
isClosed in interface DNSStatefulObject
Returns:
true if closed state, false otherwise

waitForAnnounced

public boolean waitForAnnounced(long timeout)
Waits for the object to be announced.

Specified by:
waitForAnnounced in interface DNSStatefulObject
Parameters:
timeout - the maximum time to wait in milliseconds.
Returns:
true if the object is announced, false otherwise

waitForCanceled

public boolean waitForCanceled(long timeout)
Waits for the object to be canceled.

Specified by:
waitForCanceled in interface DNSStatefulObject
Parameters:
timeout - the maximum time to wait in milliseconds.
Returns:
true if the object is canceled, false otherwise

toString

public String toString()

Overrides:
toString in class ReentrantLock

Last updated 2011-08-25 12:40

Copyright © 2002-2011 JmDNS. All Rights Reserved.