Class AtomicInput

All Implemented Interfaces:
com.codahale.metrics.Gauge<Long>, com.codahale.metrics.Metric, ActivityDefObserver, Input, NBComponent, NBComponentAdvisors, NBComponentEvents, NBComponentMetrics, NBComponentProps, NBComponentServices, NBComponentTimeline, NBProviderSearch, NBTokenWords, NBLabeledElement, AutoCloseable

public class AtomicInput extends NBBaseComponent implements Input, ActivityDefObserver, com.codahale.metrics.Gauge<Long>

TODO: This documentation is out of date as of 2.0.0

This input will provide threadsafe access to a sequence of long values.

Changes to the cycles or the targetrate will affect the provided inputs. If the min or max cycle is changed, then these are re-applied first to the max cycle and then to the min cycle. If the min cycle is changed, then the next cycle value is set to the assigned min value. Otherwise, the cycle will continue as usual till it reaches the max value. The ability to start the input while running by applying a new set of parameters makes it possible to re-trigger a sequence of inputs during a test.

This input, and Inputs in general do not actively prevent usage of values after the max value. They simply expose it to callers. It is up to the caller to check the value to determine when the input is deemed "used up."

  • Constructor Details

  • Method Details

    • getInputSegment

      public CycleSegment getInputSegment(int stride)
      Description copied from interface: Input
      Return the next InputSegment available, or null if none were available. This method is required to be thread safe.

      All implementations of this method are required to be thread-safe.

      Specified by:
      getInputSegment in interface Input
      Parameters:
      stride - The number of cycles (not necessarily contiguous) in the segment.
      Returns:
      a segment, or null if none available.
    • toString

      public String toString()
      Overrides:
      toString in class NBBaseComponent
    • onActivityDefUpdate

      public void onActivityDefUpdate(ActivityDef activityDef)
      Specified by:
      onActivityDefUpdate in interface ActivityDefObserver
    • getStartedAtMillis

      public long getStartedAtMillis()
    • isContiguous

      public boolean isContiguous()
      Specified by:
      isContiguous in interface Input
    • getValue

      public Long getValue()
      Specified by:
      getValue in interface com.codahale.metrics.Gauge<Long>