Class AsyncFortunaStandalone

All Implemented Interfaces:
IRandomStandalone, Serializable, Cloneable, Runnable

public class AsyncFortunaStandalone extends FortunaStandalone implements Runnable
fortuna instance that tries to avoid blocking if at all possible by using separate filled buffer segments rather than one buffer (and blocking when that buffer's data has been eaten) Note that this class is not fully Thread safe! The following methods must be synchronized externally, they are not synced here or in super(): addRandomByte(), addRandomBytes(), nextByte(), nextBytes(), seed()
See Also:
  • Constructor Details

    • AsyncFortunaStandalone

      public AsyncFortunaStandalone(I2PAppContext context)
  • Method Details

    • startup

      public void startup()
    • shutdown

      public void shutdown()
      Note - methods may hang or NPE or throw IllegalStateExceptions after this
      Since:
      0.8.8
    • seed

      public void seed(byte[] val)
      the seed is only propogated once the prng is started with startup()
      Overrides:
      seed in class FortunaStandalone
    • allocBuffer

      protected void allocBuffer()
      Description copied from class: FortunaStandalone
      Unused, see AsyncFortunaStandalone
      Overrides:
      allocBuffer in class FortunaStandalone
    • rotateBuffer

      protected void rotateBuffer()
      make the next available filled buffer current, scheduling any unfilled buffers for refill, and blocking until at least one buffer is ready
    • run

      public void run()
      The refiller thread
      Specified by:
      run in interface Runnable
    • fillBlock

      public void fillBlock()
      Description copied from class: FortunaStandalone
      Unused, see AsyncFortunaStandalone
      Overrides:
      fillBlock in class FortunaStandalone