Class StreamingNettyByteBody.SharedBuffer

java.lang.Object
io.micronaut.http.body.stream.BaseSharedBuffer
io.micronaut.http.netty.body.StreamingNettyByteBody.SharedBuffer
All Implemented Interfaces:
BufferConsumer
Enclosing class:
StreamingNettyByteBody

@Internal public static final class StreamingNettyByteBody.SharedBuffer extends BaseSharedBuffer
This class buffers input data and distributes it to multiple StreamingNettyByteBody instances.

Thread safety: The BufferConsumer methods must only be called from one thread, the eventLoop thread. The other methods (subscribe, reserve) can be called from any thread.

Since:
4.5.0
Author:
Jonas Konrad
  • Constructor Details

  • Method Details

    • eventLoop

      public io.netty.channel.EventLoop eventLoop()
    • setExpectedLengthFrom

      public void setExpectedLengthFrom(io.netty.handler.codec.http.HttpHeaders headers)
    • reserve0

      protected void reserve0()
      Description copied from class: BaseSharedBuffer
      Reserve a spot for a future subscribe operation.
      Not thread safe, caller must handle concurrency.
      Overrides:
      reserve0 in class BaseSharedBuffer
    • afterSubscribe

      protected void afterSubscribe(boolean last)
      Description copied from class: BaseSharedBuffer
      Called after a subscribe operation. Used for leak detection.
      Overrides:
      afterSubscribe in class BaseSharedBuffer
      Parameters:
      last - true iff this was the last reservation
    • addGuarded

      protected @Nullable List<ReadBuffer> addGuarded(ReadBuffer rb, boolean completeAfter)
      Description copied from class: BaseSharedBuffer
      Hook for subclasses that need to apply a concurrency guard around the BaseSharedBuffer.add(ReadBuffer) portion of BaseSharedBuffer.add(ReadBuffer) and BaseSharedBuffer.addAndComplete(ReadBuffer). Subclasses must call super.addGuarded(rb, completeAfter) and return its result.
      Overrides:
      addGuarded in class BaseSharedBuffer
      Parameters:
      rb - The buffer to add
      completeAfter - Whether the subscribers should be completed together with this buffer
      Returns:
      With completeAfter, the copies of rb still to be delivered to the streaming subscribers together with their completion, one per subscriber in order, or null if there are none to deliver. Always null without completeAfter.