Class KeyExchangeGenerator


  • public class KeyExchangeGenerator
    extends java.lang.Object
    Key exchange generator which can be used to pre-generate exchanges in background.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.reflect.Constructor<?> con
      Constructor for the key exchange
      protected static int DEFAULT_TARGET_PREGEN
      The default target number of pre-gen key exchanges.
      protected java.util.concurrent.BlockingQueue<IKeyExchange> pregenex
      Pre-generated exchange mechanisms.
      protected boolean running
      Running flag.
      protected java.util.concurrent.CyclicBarrier shutdownbarrier
      Barrier for coordinating shutdown.
      protected java.lang.Runnable task
      Generation task.
    • Constructor Summary

      Constructors 
      Constructor Description
      KeyExchangeGenerator​(java.lang.String exchangeclass)  
      KeyExchangeGenerator​(java.lang.String exchangeclass, int targetkeys)
      Creates a new key exchange generator.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      IKeyExchange getKeyExchange()
      Returns a new key exchange mechanism.
      void start​(IThreadExecutor texec)
      Starts the background key exchange generation.
      void stop()
      Stops the background key exchange generation.
      • Methods inherited from class java.lang.Object

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

      • DEFAULT_TARGET_PREGEN

        protected static final int DEFAULT_TARGET_PREGEN
        The default target number of pre-gen key exchanges.
        See Also:
        Constant Field Values
      • pregenex

        protected java.util.concurrent.BlockingQueue<IKeyExchange> pregenex
        Pre-generated exchange mechanisms.
      • running

        protected volatile boolean running
        Running flag.
      • shutdownbarrier

        protected java.util.concurrent.CyclicBarrier shutdownbarrier
        Barrier for coordinating shutdown.
      • con

        protected java.lang.reflect.Constructor<?> con
        Constructor for the key exchange
      • task

        protected java.lang.Runnable task
        Generation task.
    • Constructor Detail

      • KeyExchangeGenerator

        public KeyExchangeGenerator​(java.lang.String exchangeclass)
      • KeyExchangeGenerator

        public KeyExchangeGenerator​(java.lang.String exchangeclass,
                                    int targetkeys)
        Creates a new key exchange generator.
        Parameters:
        exchangeclass - Class used for key exchange.
        targetkeys - Target number of pre-generated exchanges.
    • Method Detail

      • start

        public void start​(IThreadExecutor texec)
        Starts the background key exchange generation.
      • stop

        public void stop()
        Stops the background key exchange generation.
      • getKeyExchange

        public IKeyExchange getKeyExchange()
        Returns a new key exchange mechanism.
        Returns:
        Key exchange mechanism.