Class DNSStateTask
java.lang.Object
java.util.TimerTask
javax.jmdns.impl.tasks.DNSTask
javax.jmdns.impl.tasks.state.DNSStateTask
- All Implemented Interfaces:
Runnable
This is the root class for all state tasks. These tasks work with objects that implements the
DNSStatefulObject interface and therefore participate in the state machine.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static intprivate DNSStateThe state of the task.private final intBy setting a 0 ttl we effectively expire the record.(package private) static org.slf4j.Logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected abstract voidprotected voidAssociate the DNS host and the service infos with this task if not already associated and in the same state.protected abstract DNSOutgoingprotected abstract DNSOutgoingbuildOutgoingForInfo(ServiceInfoImpl info, DNSOutgoing out) protected abstract booleanprotected abstract DNSOutgoingstatic intabstract Stringprotected DNSStateintgetTTL()protected abstract voidprotected voidRemove 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 DNSTask
addAdditionalAnswer, addAnswer, addAnswer, addAuthoritativeAnswer, addQuestion, getDns, getName, start, toStringMethods inherited from class TimerTask
cancel, scheduledExecutionTime
-
Field Details
-
logger
static org.slf4j.Logger logger -
_ttl
private final int _ttlBy setting a 0 ttl we effectively expire the record. -
_defaultTTL
private static int _defaultTTL -
_taskState
The state of the task.
-
-
Constructor Details
-
DNSStateTask
- Parameters:
jmDNSImpl-ttl-
-
-
Method Details
-
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
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
-
checkRunCondition
protected abstract boolean checkRunCondition() -
buildOutgoingForDNS
- Throws:
IOException
-
buildOutgoingForInfo
protected abstract DNSOutgoing buildOutgoingForInfo(ServiceInfoImpl info, DNSOutgoing out) throws IOException - Throws:
IOException
-
createOugoing
-
advanceObjectsState
-
recoverTask
-
advanceTask
protected abstract void advanceTask() -
getTaskState
- Returns:
- the taskState
-
setTaskState
- Parameters:
taskState- the taskState to set
-