Module org.newsclub.net.unix.server
Package org.newsclub.net.unix.server
Class AFSocketServer<A extends AFSocketAddress>
java.lang.Object
org.newsclub.net.unix.server.SocketServer<A,AFSocket<? extends A>,AFServerSocket<? extends A>>
org.newsclub.net.unix.server.AFSocketServer<A>
- Type Parameters:
A
- The supported address type.
public abstract class AFSocketServer<A extends AFSocketAddress>
extends SocketServer<A,AFSocket<? extends A>,AFServerSocket<? extends A>>
A base implementation for a simple, multi-threaded socket server using
AFSocket
s.- Author:
- Christian Kohlschütter
-
Constructor Summary
ConstructorDescriptionAFSocketServer
(A listenAddress) Creates a server using the givenSocketAddress
.AFSocketServer
(AFServerSocket<? extends A> serverSocket) Creates a server using the given, boundServerSocket
. -
Method Summary
Methods inherited from class org.newsclub.net.unix.server.SocketServer
doServeSocket, doSocketClose, getListenAddress, getMaxConcurrentConnections, getServerBusyTimeout, getServerTimeout, getSocketTimeout, isReady, isRunning, onAfterServingSocket, onBeforeServingSocket, onListenException, onListenException, onServerBound, onServerBusy, onServerReady, onServerShuttingDown, onServerStarting, onServerStopped, onServingException, onServingException, onSocketExceptionAfterAccept, onSocketExceptionDuringAccept, onSubmitted, setMaxConcurrentConnections, setServerBusyTimeout, setServerTimeout, setSocketTimeout, start, startAndWaitToBecomeReady, startAndWaitToBecomeReady, startThenStopAfter, stop
-
Constructor Details
-
AFSocketServer
Creates a server using the given, boundServerSocket
.- Parameters:
serverSocket
- The server socket to use (must be bound).
-
AFSocketServer
Creates a server using the givenSocketAddress
.- Parameters:
listenAddress
- The address to bind the socket on.
-
-
Method Details
-
newServerSocket
Description copied from class:SocketServer
Returns a new server socket.- Specified by:
newServerSocket
in classSocketServer<A extends AFSocketAddress,
AFSocket<? extends A extends AFSocketAddress>, AFServerSocket<? extends A extends AFSocketAddress>> - Returns:
- The new socket (an
AFServerSocket
if the listen address is anAFSocketAddress
). - Throws:
IOException
- on error.
-