Package org.simpleframework.transport
Class NegotiationState.Delegate
java.lang.Object
org.simpleframework.transport.NegotiationState.Delegate
- All Implemented Interfaces:
Runnable
- Enclosing class:
NegotiationState
The
Delegate
is basically a settable runnable object.
It enables the challenge to set an optional runnable that will
be executed when the challenge has completed. If the challenge
has not been given a completion task this runs straight through
without any state change or action on the certificate.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AtomicBoolean
This is used to determine if the challenge is ready to run.private final AtomicReference
<Runnable> This is the reference to the runnable that is to be executed.private final Trace
This is used to trace any errors when running the task. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
task
This is the reference to the runnable that is to be executed. -
ready
This is used to determine if the challenge is ready to run. -
trace
This is used to trace any errors when running the task.
-
-
Constructor Details
-
Delegate
Constructor for theDelegate
object. This is used to create a wrapper for the completion task so that it can be executed safely and have any errors traced.- Parameters:
socket
- this socket the handshake is associated with
-
-
Method Details
-
isSet
public boolean isSet()This is used to determine if the delegate is ready to be used. It is ready only after the completion task has been set. When ready a challenge can be executed.- Returns:
- this returns true if a completion task is set
-
set
This is used to set the completion task that is to be executed when the challenge has finished. This can be set to null if no task is to be executed on completion.- Parameters:
runnable
- the task to run when the challenge finishes
-
run
public void run()This is used to run the completion task. If no completion task has been set this will run through without any change to the state of the certificate. All errors thrown by the task will be caught and traced.
-