Package javax.jmdns.impl.tasks.state
Class DNSStateTask
- java.lang.Object
-
- java.util.TimerTask
-
- javax.jmdns.impl.tasks.DNSTask
-
- javax.jmdns.impl.tasks.state.DNSStateTask
-
- All Implemented Interfaces:
java.lang.Runnable
public abstract class DNSStateTask extends DNSTask
This is the root class for all state tasks. These tasks work with objects that implements theDNSStatefulObjectinterface and therefore participate in the state machine.
-
-
Field Summary
Fields Modifier and Type Field Description private static int_defaultTTLprivate DNSState_taskStateThe state of the task.private int_ttlBy setting a 0 ttl we effectively expire the record.(package private) static org.slf4j.Loggerlogger
-
Constructor Summary
Constructors Constructor Description DNSStateTask(JmDNSImpl jmDNSImpl, int ttl)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidadvanceObjectsState(java.util.List<DNSStatefulObject> list)protected abstract voidadvanceTask()protected voidassociate(DNSState state)Associate the DNS host and the service infos with this task if not already associated and in the same state.protected abstract DNSOutgoingbuildOutgoingForDNS(DNSOutgoing out)protected abstract DNSOutgoingbuildOutgoingForInfo(ServiceInfoImpl info, DNSOutgoing out)protected abstract booleancheckRunCondition()protected abstract DNSOutgoingcreateOugoing()static intdefaultTTL()abstract java.lang.StringgetTaskDescription()protected DNSStategetTaskState()intgetTTL()protected abstract voidrecoverTask(java.lang.Throwable e)protected voidremoveAssociation()Remove the DNS host and service info association with this task.voidrun()static voidsetDefaultTTL(int value)For testing only do not use in production.protected voidsetTaskState(DNSState taskState)-
Methods inherited from class javax.jmdns.impl.tasks.DNSTask
addAdditionalAnswer, addAnswer, addAnswer, addAuthoritativeAnswer, addQuestion, getDns, getName, start, toString
-
-
-
-
Field Detail
-
logger
static org.slf4j.Logger logger
-
_ttl
private final int _ttl
By setting a 0 ttl we effectively expire the record.
-
_defaultTTL
private static int _defaultTTL
-
_taskState
private DNSState _taskState
The state of the task.
-
-
Constructor Detail
-
DNSStateTask
public DNSStateTask(JmDNSImpl jmDNSImpl, int ttl)
- Parameters:
jmDNSImpl-ttl-
-
-
Method Detail
-
getTaskDescription
public abstract java.lang.String getTaskDescription()
-
defaultTTL
public static int defaultTTL()
-
setDefaultTTL
public static void setDefaultTTL(int value)
For testing only do not use in production.- Parameters:
value-
-
getTTL
public int getTTL()
- Returns:
- the ttl
-
associate
protected void associate(DNSState state)
Associate the DNS host and the service infos with this task if not already associated and in the same state.- Parameters:
state- target state
-
removeAssociation
protected void removeAssociation()
Remove the DNS host and service info association with this task.
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable- Specified by:
runin classjava.util.TimerTask
-
checkRunCondition
protected abstract boolean checkRunCondition()
-
buildOutgoingForDNS
protected abstract DNSOutgoing buildOutgoingForDNS(DNSOutgoing out) throws java.io.IOException
- Throws:
java.io.IOException
-
buildOutgoingForInfo
protected abstract DNSOutgoing buildOutgoingForInfo(ServiceInfoImpl info, DNSOutgoing out) throws java.io.IOException
- Throws:
java.io.IOException
-
createOugoing
protected abstract DNSOutgoing createOugoing()
-
advanceObjectsState
protected void advanceObjectsState(java.util.List<DNSStatefulObject> list)
-
recoverTask
protected abstract void recoverTask(java.lang.Throwable e)
-
advanceTask
protected abstract void advanceTask()
-
getTaskState
protected DNSState getTaskState()
- Returns:
- the taskState
-
setTaskState
protected void setTaskState(DNSState taskState)
- Parameters:
taskState- the taskState to set
-
-