Class Scatter

All Implemented Interfaces:
PlotChangeListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants

public class Scatter extends AExample

Scatter (DAQ enqueue stress test)

This example is intentionally designed as a thread stress test that simulates a streaming data-acquisition (DAQ) system.

What is being tested

This is the correct way to stress concurrency without reintroducing races between painting and model mutation. The old “unsafe mode” (background threads calling curve.add(...)) is now prevented by EDT guards and should fail fast.

Key design choice

fillData() is intentionally a no-op. Data arrives over time via producers.

Tuning knobs

  • PRODUCER_COUNT - number of concurrent DAQ sources
  • PRODUCER_PERIOD_MS - point production interval per source
  • DRAIN_PERIOD_MS - EDT drain frequency
  • MAX_DRAIN_PER_TICK - max points applied per drain tick
  • MAX_POINTS - max points retained in the curve (demonstrates stop enqueuing)
See Also: