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 void
Called when a connection closed.protected void
Called every loop iteration inSelectorHandler.runSelectorLoop()
, which is every timeSelector.select()
returns, either because aSelectionKey
was 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 void
Notify thisConnectionSelectorHandler
that aChannelConnection
was 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 thisConnectionSelectorHandler
that aChannelConnection
was closed locally by a call toSocketConnection.close()
.- Parameters:
conn
- The connection that closed
-
loopIteration
Description copied from class:SelectorHandler
Called every loop iteration inSelectorHandler.runSelectorLoop()
, which is every timeSelector.select()
returns, either because aSelectionKey
was 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:
loopIteration
in classSelectorHandler
- Throws:
IOException
- If an IO error occurs
-