Class PlatformThreadedNNTPDaemon

java.lang.Object
org.sonews.daemon.DaemonRunner
org.sonews.daemon.io.PlatformThreadedNNTPDaemon
All Implemented Interfaces:
Runnable, DaemonRunnable, NNTPDaemonRunnable

@Component public class PlatformThreadedNNTPDaemon extends DaemonRunner
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 Details

    • context

      @Autowired protected org.springframework.context.ApplicationContext context
    • logger

      @Autowired protected Log logger
    • port

      protected int port
    • serverSocket

      protected ServerSocket serverSocket
    • threadPool

      protected ExecutorService 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 interface NNTPDaemonRunnable
    • dispose

      public void dispose()
      Close the server socket and shutdown the thread pool.
      Specified by:
      dispose in interface DaemonRunnable