Package io.micronaut.http.netty.body
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
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class io.micronaut.http.body.stream.BaseSharedBuffer
BaseSharedBuffer.AsFlux, BaseSharedBuffer.IncorrectContentLengthExceptionNested classes/interfaces inherited from interface io.micronaut.http.body.stream.BufferConsumer
BufferConsumer.Upstream -
Constructor Summary
ConstructorsConstructorDescriptionSharedBuffer(io.netty.channel.EventLoop loop, NettyByteBodyFactory byteBodyFactory, BodySizeLimits limits, BufferConsumer.Upstream rootUpstream) -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(ReadBuffer rb) Add a given buffer to thisBaseSharedBuffer.
Not thread safe, caller must handle concurrency.protected voidafterSubscribe(boolean last) Called after a subscribe operation.io.netty.channel.EventLoopprotected voidreserve0()Reserve a spot for a future subscribe operation.
Not thread safe, caller must handle concurrency.voidsetExpectedLengthFrom(io.netty.handler.codec.http.HttpHeaders headers) Methods inherited from class io.micronaut.http.body.stream.BaseSharedBuffer
complete, error, getExpectedLength, getLimits, getRootUpstream, logClaim, setExpectedLength, setExpectedLengthFrom, subscribe0, subscribeFull0Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.http.body.stream.BufferConsumer
discard
-
Constructor Details
-
SharedBuffer
public SharedBuffer(io.netty.channel.EventLoop loop, NettyByteBodyFactory byteBodyFactory, BodySizeLimits limits, BufferConsumer.Upstream rootUpstream)
-
-
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:BaseSharedBufferReserve a spot for a future subscribe operation.
Not thread safe, caller must handle concurrency.- Overrides:
reserve0in classBaseSharedBuffer
-
afterSubscribe
protected void afterSubscribe(boolean last) Description copied from class:BaseSharedBufferCalled after a subscribe operation. Used for leak detection.- Overrides:
afterSubscribein classBaseSharedBuffer- Parameters:
last-trueiff this was the last reservation
-
add
Description copied from class:BaseSharedBufferAdd a given buffer to thisBaseSharedBuffer.
Not thread safe, caller must handle concurrency.- Specified by:
addin interfaceBufferConsumer- Overrides:
addin classBaseSharedBuffer- Parameters:
rb- The buffer
-