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.IncorrectContentLengthException
Nested 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 TypeMethodDescriptionvoid
add
(ReadBuffer rb) Add a given buffer to thisBaseSharedBuffer
.
Not thread safe, caller must handle concurrency.protected void
afterSubscribe
(boolean last) Called after a subscribe operation.io.netty.channel.EventLoop
protected void
reserve0()
Reserve a spot for a future subscribe operation.
Not thread safe, caller must handle concurrency.void
setExpectedLengthFrom
(io.netty.handler.codec.http.HttpHeaders headers) Methods inherited from class io.micronaut.http.body.stream.BaseSharedBuffer
complete, error, failClaim, getExpectedLength, getLimits, getRootUpstream, logClaim, setExpectedLength, setExpectedLengthFrom, subscribe0, subscribeFull0
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:BaseSharedBuffer
Reserve a spot for a future subscribe operation.
Not thread safe, caller must handle concurrency.- Overrides:
reserve0
in classBaseSharedBuffer
-
afterSubscribe
protected void afterSubscribe(boolean last) Description copied from class:BaseSharedBuffer
Called after a subscribe operation. Used for leak detection.- Overrides:
afterSubscribe
in classBaseSharedBuffer
- Parameters:
last
-true
iff this was the last reservation
-
add
Description copied from class:BaseSharedBuffer
Add a given buffer to thisBaseSharedBuffer
.
Not thread safe, caller must handle concurrency.- Specified by:
add
in interfaceBufferConsumer
- Overrides:
add
in classBaseSharedBuffer
- Parameters:
rb
- The buffer
-