Interface RequestPacketHandler<P extends Packet,R extends Packet,S extends EngineConnectionState>
- Type Parameters:
P
- The request packet typeR
- The response packet typeS
- The connection state
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface
public interface RequestPacketHandler<P extends Packet,R extends Packet,S extends EngineConnectionState>
Represents a packet handler for
RequestPacket
s.-
Method Summary
Modifier and TypeMethodDescriptionvoid
handleRequest
(P requestPacket, S state, RequestPacketResponse<R> response) Handles theRequestPacket
which was send by a specificRemoteConnection
.
-
Method Details
-
handleRequest
Handles theRequestPacket
which was send by a specificRemoteConnection
. A proper responsePacket
should be answered with.Throwing a
ChannelException
during the execution of this handler will automatically be applied to theRequestPacketResponse
.Every handled request should apply the proper response to
RequestPacketResponse
. Responding doesn't have to be instantly and can be from a concurrent context, but it shouldn't take minutes.- Parameters:
requestPacket
- The received request packetstate
- The state that sent the packetresponse
- The response which should be completed
-