Class TransformingFlusher

java.lang.Object
org.eclipse.jetty.websocket.core.internal.TransformingFlusher
Direct Known Subclasses:
FragmentingFlusher

public abstract class TransformingFlusher extends Object
This is used to iteratively transform or process a frame into one or more other frames. When a frame is ready to be processed onFrame(Frame, Callback, boolean) is called. Subsequent calls to transform(Callback) are made on each callback success until one of these calls returns true to indicate they are done processing the frame and are ready to receive a new one. The Callback passed in to both these method must be succeeded in order to continue processing.
  • Constructor Details

    • TransformingFlusher

      public TransformingFlusher()
  • Method Details

    • onFrame

      protected abstract boolean onFrame(Frame frame, Callback callback, boolean batch)
      Called when a frame is ready to be transformed.
      Parameters:
      frame - the frame to transform.
      callback - used to signal to start processing again.
      batch - whether this frame can be batched.
      Returns:
      true to indicate that you have finished transforming this frame.
    • transform

      protected abstract boolean transform(Callback callback)
      Called to transform the frame given in onFrame(Frame, Callback, boolean). This method is called on each callback success until it returns true. If the call to onFrame(Frame, Callback, boolean) returns true then this method will not be called.
      Parameters:
      callback - used to signal to start processing again.
      Returns:
      true to indicate that you have finished transforming this frame.
    • sendFrame

      public final void sendFrame(Frame frame, Callback callback, boolean batch)
    • closeFlusher

      public void closeFlusher()
      Used to close this flusher when there is no explicit failure.
    • failFlusher

      public void failFlusher(Throwable t)
      Used to fail this flusher possibly from an external event such as a callback.
      Parameters:
      t - the failure.