# 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`

public abstract class SocketProcessorBase<S> extends Object implements Runnable
Base class for socket processors that handle I/O events on a wrapped socket. Subclasses implement `doRun()` to define the processing logic.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected SocketEvent`
`event`
The event that triggered this processor (e.g., READ, WRITE).
`protected SocketWrapperBase<S>`
`socketWrapper`
The socket wrapper that provides access to the underlying socket and its state.

## Constructor Summary

Constructors
Constructor
Description
`SocketProcessorBase(SocketWrapperBase<S> socketWrapper, SocketEvent event)`
Creates a new socket processor for the given wrapper and event.

## Method Summary

Modifier and Type
Method
Description
`protected abstract void`
`doRun()`
Performs the actual socket processing work.
`void`
`reset(SocketWrapperBase<S> socketWrapper, SocketEvent event)`
Resets this processor with a new socket wrapper and event, allowing reuse.
`final void`
`run()`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### socketWrapper

protected SocketWrapperBase<S> socketWrapper
The socket wrapper that provides access to the underlying socket and its state.

### event

protected SocketEvent event
The event that triggered this processor (e.g., READ, WRITE).

## Constructor Details

### SocketProcessorBase

public SocketProcessorBase(SocketWrapperBase<S> socketWrapper, SocketEvent event)
Creates a new socket processor for the given wrapper and event.

Parameters:
  `socketWrapper` - the socket wrapper
  `event` - the socket event to process

## Method Details

### reset

public void reset(SocketWrapperBase<S> socketWrapper, SocketEvent event)
Resets this processor with a new socket wrapper and event, allowing reuse.

Parameters:
  `socketWrapper` - the socket wrapper
  `event` - the socket event to process

### run

public final void run()

Specified by:
  `run` in interface `Runnable`

### 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.