public class SocketEventHandler extends EventHandler
Constructor and Description |
---|
SocketEventHandler(org.apache.logging.log4j.Logger logger,
java.util.function.BiConsumer<NioSocketChannel,java.lang.Throwable> exceptionHandler) |
Modifier and Type | Method and Description |
---|---|
void |
connectException(NioSocketChannel channel,
java.lang.Exception exception)
This method is called when an attempt to connect a channel throws an exception.
|
void |
genericChannelException(NioSocketChannel channel,
java.lang.Exception exception)
This method is called when handling an event from a channel fails due to an unexpected exception.
|
void |
handleConnect(NioSocketChannel channel)
This method is called when a NioSocketChannel is successfully connected.
|
void |
handleRead(NioSocketChannel channel)
This method is called when a channel signals it is ready for be read.
|
void |
handleRegistration(NioSocketChannel channel)
This method is called when a NioSocketChannel is successfully registered.
|
void |
handleWrite(NioSocketChannel channel)
This method is called when a channel signals it is ready to receive writes.
|
void |
readException(NioSocketChannel channel,
java.lang.Exception exception)
This method is called when an attempt to read from a channel throws an exception.
|
void |
registrationException(NioSocketChannel channel,
java.lang.Exception exception)
This method is called when an attempt to register a channel throws an exception.
|
void |
writeException(NioSocketChannel channel,
java.lang.Exception exception)
This method is called when an attempt to write to a channel throws an exception.
|
closeSelectorException, handleClose, selectException, uncaughtException
public SocketEventHandler(org.apache.logging.log4j.Logger logger, java.util.function.BiConsumer<NioSocketChannel,java.lang.Throwable> exceptionHandler)
public void handleRegistration(NioSocketChannel channel)
channel
- that was registeredpublic void registrationException(NioSocketChannel channel, java.lang.Exception exception)
channel
- that was registeredexception
- that occurredpublic void handleConnect(NioSocketChannel channel)
channel
- that was registeredpublic void connectException(NioSocketChannel channel, java.lang.Exception exception)
channel
- that was connectingexception
- that occurredpublic void handleRead(NioSocketChannel channel) throws java.io.IOException
channel
- that can be readjava.io.IOException
public void readException(NioSocketChannel channel, java.lang.Exception exception)
channel
- that was being readexception
- that occurredpublic void handleWrite(NioSocketChannel channel) throws java.io.IOException
channel
- that can be readjava.io.IOException
public void writeException(NioSocketChannel channel, java.lang.Exception exception)
channel
- that was being written toexception
- that occurredpublic void genericChannelException(NioSocketChannel channel, java.lang.Exception exception)
SelectionKey
threw
CancelledKeyException
.channel
- that caused the exceptionexception
- that was thrown