Class CurrentTimeIncrementalNonceFactory

java.lang.Object
org.knowm.xchange.utils.nonce.CurrentTimeIncrementalNonceFactory
All Implemented Interfaces:
si.mazi.rescu.SynchronizedValueFactory<Long>

public class CurrentTimeIncrementalNonceFactory extends Object implements si.mazi.rescu.SynchronizedValueFactory<Long>
Class computes a current time based nonce.

This class while designed to be thread-safe does not protect against multiple processes where the system clock may be out of sync. It also does not protect a system where a lower granularity time unit like TimeUnit.SECONDS is used and the same nonce is computed at the same time from competing processes.

Compatibility is limited to the time units specified.

  • Constructor Details

    • CurrentTimeIncrementalNonceFactory

      public CurrentTimeIncrementalNonceFactory(TimeUnit timeUnit)
  • Method Details

    • createValue

      public Long createValue()
      Specified by:
      createValue in interface si.mazi.rescu.SynchronizedValueFactory<Long>