Package org.omegazero.net.common
Class ConnectionSelectorHandler
java.lang.Object
org.omegazero.net.common.SelectorHandler
org.omegazero.net.common.ConnectionSelectorHandler
- Direct Known Subclasses:
TCPClientManager,TCPServer,UDPClientManager,UDPServer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCalled when a connection closed.protected voidCalled every loop iteration inSelectorHandler.runSelectorLoop(), which is every timeSelector.select()returns, either because aSelectionKeywas selected or the selector was woken up for any other reason (for example after a call toSelectorHandler.selectorWakeup()).
This method does nothing by default.protected voidNotify thisConnectionSelectorHandlerthat aChannelConnectionwas closed locally by a call toSocketConnection.close().Methods inherited from class org.omegazero.net.common.SelectorHandler
closeSelector, handleSelectedKey, initSelector, isRunning, registerChannel, registerChannel, runSelectorLoop, selectorKeys, selectorWakeup
-
Constructor Details
-
ConnectionSelectorHandler
public ConnectionSelectorHandler()
-
-
Method Details
-
handleConnectionClosed
Called when a connection closed.- Parameters:
conn-- Throws:
IOException
-
onConnectionClosed
Notify thisConnectionSelectorHandlerthat aChannelConnectionwas closed locally by a call toSocketConnection.close().- Parameters:
conn- The connection that closed
-
loopIteration
Description copied from class:SelectorHandlerCalled every loop iteration inSelectorHandler.runSelectorLoop(), which is every timeSelector.select()returns, either because aSelectionKeywas selected or the selector was woken up for any other reason (for example after a call toSelectorHandler.selectorWakeup()).
This method does nothing by default. Subclasses may override this method to perform additional required operations.- Overrides:
loopIterationin classSelectorHandler- Throws:
IOException- If an IO error occurs
-