Class Broker.Producer<V>

  • Direct Known Subclasses:
    IterableProducer, StreamProducer
    Enclosing class:
    Broker<V>

    public abstract static class Broker.Producer<V>
    extends Object

    A producer generates data to be consumed. Implementations of Producer should use the start() to begin the production process, stop() to signal production has finished, and yield(Object) to offer an item up for consumption.

    • Constructor Detail

      • Producer

        public Producer()
    • Method Detail

      • isRunning

        public boolean isRunning()
        Returns:
        True if the producer is still running.
      • produce

        public abstract void produce()
        Logic for producing items to be consumed.
      • start

        protected void start()
        Signals the production has started.
      • stop

        protected void stop()
        Signals that the producer is finished and its thread can be released.
      • yield

        protected final void yield​(V object)
        offers an object to be consumed, blocking if the Broker's queue is full.
        Parameters:
        object - the object