Class NegotiationState.Delegate

java.lang.Object
org.simpleframework.transport.NegotiationState.Delegate
All Implemented Interfaces:
Runnable
Enclosing class:
NegotiationState

private class NegotiationState.Delegate extends Object implements Runnable
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

    Fields
    Modifier and Type
    Field
    Description
    private 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
    Constructor
    Description
    Delegate(Socket socket)
    Constructor for the Delegate object.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    This is used to determine if the delegate is ready to be used.
    void
    run()
    This is used to run the completion task.
    void
    set(Runnable runnable)
    This is used to set the completion task that is to be executed when the challenge has finished.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • task

      private final AtomicReference<Runnable> task
      This is the reference to the runnable that is to be executed.
    • ready

      private final 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 Details

    • Delegate

      public Delegate(Socket socket)
      Constructor for the Delegate 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

      public void set(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:
      run in interface Runnable