Top Description Inners Fields Constructors Methods
io.netty5.channel

public abstract Class MaxMessagesReadHandleFactory

extends Object
implements ReadHandleFactory
Class Inheritance
All Implemented Interfaces
io.netty5.channel.ReadHandleFactory
Known Direct Subclasses
io.netty5.channel.ServerChannelReadHandleFactory, io.netty5.channel.FixedReadHandleFactory, io.netty5.channel.AdaptiveReadHandleFactory
Static Imports
io.netty5.util.internal.ObjectUtil.checkPositive

Base implementation of ReadHandleFactory which allows to limit the number of messages read per read loop.

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected abstract static class
MaxMessagesReadHandleFactory.MaxMessageReadHandle

Focuses on enforcing the maximum messages per read condition for lastRead(int, int, int).

Field Summary

Modifier and TypeField and Description
private final int

Constructor Summary

AccessConstructor and Description
protected
protected
MaxMessagesReadHandleFactory(int maxMessagesPerRead)

Method Summary

Modifier and TypeMethod and Description
public final ReadHandleFactory.ReadHandle
newHandle(Channel
the Channel for which the ReadHandle is used.
channel
)

Implements io.netty5.channel.ReadHandleFactory.newHandle.

Creates a new handle for the given Channel.
protected abstract MaxMessagesReadHandleFactory.MaxMessageReadHandle

Returns:

the handle.
newMaxMessageHandle
(int
the maximum number of messages to read per read loop.
maxMessagesPerRead
)

Creates a new MaxMessageReadHandle to use.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

maxMessagesPerReadback to summary
private final int maxMessagesPerRead

Constructor Detail

MaxMessagesReadHandleFactoryback to summary
protected MaxMessagesReadHandleFactory()
MaxMessagesReadHandleFactoryback to summary
protected MaxMessagesReadHandleFactory(int maxMessagesPerRead)

Method Detail

newHandleback to summary
public final ReadHandleFactory.ReadHandle newHandle(Channel channel)

Implements io.netty5.channel.ReadHandleFactory.newHandle.

Doc from io.netty5.channel.ReadHandleFactory.newHandle.

Creates a new handle for the given Channel.

Parameters
channel:Channel

the Channel for which the ReadHandle is used.

Annotations
@Override
newMaxMessageHandleback to summary
protected abstract MaxMessagesReadHandleFactory.MaxMessageReadHandle newMaxMessageHandle(int maxMessagesPerRead)

Creates a new MaxMessageReadHandle to use.

Parameters
maxMessagesPerRead:int

the maximum number of messages to read per read loop.

Returns:MaxMessagesReadHandleFactory.MaxMessageReadHandle

the handle.

io.netty5.channel back to summary

protected abstract Class MaxMessagesReadHandleFactory.MaxMessageReadHandle

extends Object
implements ReadHandle
Class Inheritance
  • java.lang.Object
  • io.netty5.channel.MaxMessagesReadHandleFactory.MaxMessageReadHandle
All Implemented Interfaces
io.netty5.channel.ReadHandleFactory.ReadHandle
Known Direct Subclasses
io.netty5.channel.FixedReadHandleFactory.ReadHandleImpl, io.netty5.channel.AdaptiveReadHandleFactory.ReadHandleImpl

Focuses on enforcing the maximum messages per read condition for lastRead(int, int, int).

Field Summary

Modifier and TypeField and Description
private final int
private int

Constructor Summary

AccessConstructor and Description
protected
MaxMessageReadHandle(int maxMessagesPerRead)

Method Summary

Modifier and TypeMethod and Description
public boolean
lastRead(int
The number of bytes the read operation did attempt to read.
attemptedBytesRead
,
int
The number of bytes from the previous read operation. This may be negative if a read error occurs.
actualBytesRead
,
int
The number of messages read.
numMessagesRead
)

Implements io.netty5.channel.ReadHandleFactory.ReadHandle.lastRead.

Notify the ReadHandle of the last read operation and its result.
public void
readComplete()

Implements io.netty5.channel.ReadHandleFactory.ReadHandle.readComplete.

Method that must be called once the read loop was completed.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

maxMessagesPerReadback to summary
private final int maxMessagesPerRead
totalMessagesback to summary
private int totalMessages

Constructor Detail

MaxMessageReadHandleback to summary
protected MaxMessageReadHandle(int maxMessagesPerRead)

Method Detail

lastReadback to summary
public boolean lastRead(int attemptedBytesRead, int actualBytesRead, int numMessagesRead)

Implements io.netty5.channel.ReadHandleFactory.ReadHandle.lastRead.

Doc from io.netty5.channel.ReadHandleFactory.ReadHandle.lastRead.

Notify the ReadHandle of the last read operation and its result.

Parameters
attemptedBytesRead:int

The number of bytes the read operation did attempt to read.

actualBytesRead:int

The number of bytes from the previous read operation. This may be negative if a read error occurs.

numMessagesRead:int

The number of messages read.

Returns:boolean

true if the read loop should continue reading, false otherwise.

Annotations
@Override
readCompleteback to summary
public void readComplete()

Implements io.netty5.channel.ReadHandleFactory.ReadHandle.readComplete.

Doc from io.netty5.channel.ReadHandleFactory.ReadHandle.readComplete.

Method that must be called once the read loop was completed.

Annotations
@Override