Package org.simpleframework.transport
Class NegotiationState.Delegate
- java.lang.Object
-
- org.simpleframework.transport.NegotiationState.Delegate
-
- All Implemented Interfaces:
java.lang.Runnable
- Enclosing class:
- NegotiationState
private class NegotiationState.Delegate extends java.lang.Object implements java.lang.RunnableTheDelegateis 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
Fields Modifier and Type Field Description private java.util.concurrent.atomic.AtomicBooleanreadyThis is used to determine if the challenge is ready to run.private java.util.concurrent.atomic.AtomicReference<java.lang.Runnable>taskThis is the reference to the runnable that is to be executed.private TracetraceThis is used to trace any errors when running the task.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisSet()This is used to determine if the delegate is ready to be used.voidrun()This is used to run the completion task.voidset(java.lang.Runnable runnable)This is used to set the completion task that is to be executed when the challenge has finished.
-
-
-
Field Detail
-
task
private final java.util.concurrent.atomic.AtomicReference<java.lang.Runnable> task
This is the reference to the runnable that is to be executed.
-
ready
private final java.util.concurrent.atomic.AtomicBoolean ready
This is used to determine if the challenge is ready to run.
-
trace
private final Trace trace
This is used to trace any errors when running the task.
-
-
Constructor Detail
-
Delegate
public Delegate(Socket socket)
Constructor for theDelegateobject. 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 Detail
-
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
public void set(java.lang.Runnable runnable)
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.- Specified by:
runin interfacejava.lang.Runnable
-
-