Class SimpleSocketServer

java.lang.Object
java.lang.Thread
ch.qos.logback.classic.net.SimpleSocketServer
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
SimpleSSLSocketServer

public class SimpleSocketServer extends Thread
A simple SocketNode based server.
      <b>Usage:</b> java ch.qos.logback.classic.net.SimpleSocketServer port configFile
 
where port is a port number where the server listens and configFile is an xml configuration file fed to JoranConfigurator.
Since:
0.8.4
  • Field Details

    • logger

      org.slf4j.Logger logger
    • port

      private final int port
    • lc

      private final LoggerContext lc
    • closed

      private boolean closed
    • serverSocket

      private ServerSocket serverSocket
    • socketNodeList

      private List<SocketNode> socketNodeList
    • latch

      private CountDownLatch latch
  • Constructor Details

    • SimpleSocketServer

      public SimpleSocketServer(LoggerContext lc, int port)
  • Method Details

    • main

      public static void main(String[] argv) throws Exception
      Throws:
      Exception
    • doMain

      protected static void doMain(Class<? extends SimpleSocketServer> serverClass, String[] argv) throws Exception
      Throws:
      Exception
    • run

      public void run()
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread
    • getServerThreadName

      protected String getServerThreadName()
      Returns the name given to the server thread.
    • getClientThreadName

      protected String getClientThreadName(Socket socket)
      Returns a name to identify each client thread.
    • getServerSocketFactory

      protected ServerSocketFactory getServerSocketFactory()
      Gets the platform default ServerSocketFactory.

      Subclasses may override to provide a custom server socket factory.

    • signalAlmostReadiness

      void signalAlmostReadiness()
      Signal another thread that we have established a connection This is useful for testing purposes.
    • setLatch

      void setLatch(CountDownLatch latch)
      Used for testing purposes
      Parameters:
      latch -
    • getLatch

      public CountDownLatch getLatch()
      Used for testing purposes
    • isClosed

      public boolean isClosed()
    • close

      public void close()
    • socketNodeClosing

      public void socketNodeClosing(SocketNode sn)
    • usage

      static void usage(String msg)
    • parsePortNumber

      static int parsePortNumber(String portStr)
    • configureLC

      public static void configureLC(LoggerContext lc, String configFile) throws JoranException
      Throws:
      JoranException