java.lang.Object
net.i2p.util.SimpleTimer2.TimedEvent
net.i2p.client.streaming.impl.MessageOutputStream.Flusher
All Implemented Interfaces:
Runnable
Enclosing class:
MessageOutputStream

private class MessageOutputStream.Flusherextends SimpleTimer2.TimedEvent
Passive flush timer to flush buffered data after inactivity delay. Ensures data does not stay buffered indefinitely.
  • Field Details

    • _enqueued

      private volatile boolean _enqueued
      True while the stream waits in the event queue.
  • Constructor Details

    • Flusher

      public Flusher(SimpleTimer2 timer)
      Flusher with the given timer.
      Parameters:
      timer - timer to schedule flush events
  • Method Details

    • enqueue

      public void enqueue()
      Enqueues or reschedules the flush event after the passive flush delay. Avoids scheduling duplicate flush events.
    • timeReached

      public void timeReached()
      Called when flush timer expires. Attempts passive flush if no recent writes detected or if no write in progress.
      Specified by:
      timeReached in class SimpleTimer2.TimedEvent
    • doFlush

      private void doFlush()
      Performs the actual flush of buffered data, if any. If data is available and the passive flush delay has elapsed, writes data to the data receiver and resets the buffer.

      Handles null WriteStatus gracefully to avoid NullPointerException.