- All Superinterfaces:
AutoCloseable
,Closeable
Each socket, regardless or protocol and whether client or server, has a
context.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addSocketContextListener
(SocketContextListener listener, boolean synchronous) void
close()
Closes this context.getSocket
(Identifier id) Gets the socket of the given ID ornull
if not found.Map
<Identifier, ? extends Socket> Gets a snapshot of all active sockets.boolean
isClosed()
boolean
-
Method Details
-
getSockets
Map<Identifier,? extends Socket> getSockets()Gets a snapshot of all active sockets. If context is closed will be an empty map. -
getSocket
Gets the socket of the given ID ornull
if not found. -
close
Closes this context. When the context is closed, all active sockets are closed and all related persistent resources are freed.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
isClosed
boolean isClosed() -
addSocketContextListener
-
removeSocketContextListener
-