Class NegotiationState.Delegate

  • All Implemented Interfaces:
    java.lang.Runnable
    Enclosing class:
    NegotiationState

    private class NegotiationState.Delegate
    extends java.lang.Object
    implements java.lang.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 java.util.concurrent.atomic.AtomicBoolean ready
      This is used to determine if the challenge is ready to run.
      private java.util.concurrent.atomic.AtomicReference<java.lang.Runnable> task
      This is the reference to the runnable that is to be executed.
      private Trace 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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean isSet()
      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​(java.lang.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 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 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 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:
        run in interface java.lang.Runnable