Package org.sonews.daemon.io
Class PlatformThreadedNNTPDaemon
java.lang.Object
org.sonews.daemon.DaemonRunner
org.sonews.daemon.io.PlatformThreadedNNTPDaemon
- All Implemented Interfaces:
Runnable
,DaemonRunnable
,NNTPDaemonRunnable
An NNTP daemon listening for incoming connections. This implementation of
NNTPDaemonRunnable uses a dynamically growing and shrinking pool of platform
threads to handle the incoming connections. The number of threads is between
min(4, 2*CPU-Cores) to min(128, 20*CPU_Cores). Due to the hard upper limit
this effectively limits the maximum number of connections that can be
processed in parallel. If there are more than 128 (or 20*CPU_Cores) incoming
connections, new connections will be rejected.
Due to this limitations the VirtualThreadedNNTPDaemon is the better choice
in almost any situation.
- Author:
- Christian Lins
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContext
protected Log
protected int
protected ServerSocket
protected ExecutorService
Fields inherited from class org.sonews.daemon.DaemonRunner
daemon
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.sonews.daemon.DaemonRunner
setDaemon
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.sonews.daemon.DaemonRunnable
setDaemon
-
Field Details
-
context
@Autowired protected org.springframework.context.ApplicationContext context -
logger
-
port
protected int port -
serverSocket
-
threadPool
-
-
Constructor Details
-
PlatformThreadedNNTPDaemon
public PlatformThreadedNNTPDaemon()
-
-
Method Details
-
run
public void run()Opens a server socket on the configured port and waits for incoming connections. -
setPort
public void setPort(int port) - Specified by:
setPort
in interfaceNNTPDaemonRunnable
-
dispose
public void dispose()Close the server socket and shutdown the thread pool.- Specified by:
dispose
in interfaceDaemonRunnable
-