Package org.apache.tomcat.util.net
Class SocketProcessorBase<S>
java.lang.Object
org.apache.tomcat.util.net.SocketProcessorBase<S>
- Type Parameters:
S- the type of the socket associated with the wrapper
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
Nio2Endpoint.SocketProcessor,NioEndpoint.SocketProcessor
Base class for socket processors that handle I/O events on a wrapped socket.
Subclasses implement
doRun() to define the processing logic.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SocketEventThe event that triggered this processor (e.g., READ, WRITE).protected SocketWrapperBase<S> The socket wrapper that provides access to the underlying socket and its state. -
Constructor Summary
ConstructorsConstructorDescriptionSocketProcessorBase(SocketWrapperBase<S> socketWrapper, SocketEvent event) Creates a new socket processor for the given wrapper and event. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voiddoRun()Performs the actual socket processing work.voidreset(SocketWrapperBase<S> socketWrapper, SocketEvent event) Resets this processor with a new socket wrapper and event, allowing reuse.final voidrun()
-
Field Details
-
socketWrapper
The socket wrapper that provides access to the underlying socket and its state. -
event
The event that triggered this processor (e.g., READ, WRITE).
-
-
Constructor Details
-
SocketProcessorBase
Creates a new socket processor for the given wrapper and event.- Parameters:
socketWrapper- the socket wrapperevent- the socket event to process
-
-
Method Details
-
reset
Resets this processor with a new socket wrapper and event, allowing reuse.- Parameters:
socketWrapper- the socket wrapperevent- the socket event to process
-
run
public final void run() -
doRun
protected abstract void doRun()Performs the actual socket processing work. Subclasses implement this method to define the specific processing logic for each endpoint type.
-