Top Description Fields Constructors Methods
ch.qos.logback.classic.net

public Class SimpleSocketServer

extends Thread
Class Inheritance
Known Direct Subclasses
ch.qos.logback.classic.net.SimpleSSLSocketServer
Imports
java.io.IOException, java.net.ServerSocket, .Socket, java.util.ArrayList, .List, java.util.concurrent.CountDownLatch, javax.net.ServerSocketFactory, org.slf4j.Logger, .LoggerFactory, ch.qos.logback.classic.LoggerContext, ch.qos.logback.classic.joran.JoranConfigurator, ch.qos.logback.core.joran.spi.JoranException

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.
Authors
Ceki Gülcü, Sébastien Pennec
Since
0.8.4

Field Summary

Modifier and TypeField and Description
private boolean
private CountDownLatch
private final LoggerContext
pack-priv Logger
private final int
private ServerSocket
private List<SocketNode>
Inherited from java.lang.Thread:
MAX_PRIORITYMIN_PRIORITYNORM_PRIORITY

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
public static void
protected static void
doMain(Class<? extends SimpleSocketServer> serverClass, String[] argv)

protected String
getClientThreadName(Socket socket)

Returns a name to identify each client thread.

public CountDownLatch
getLatch()

Used for testing purposes

protected ServerSocketFactory
getServerSocketFactory()

Gets the platform default ServerSocketFactory.

protected String
getServerThreadName()

Returns the name given to the server thread.

public boolean
public static void
main(String[] argv)

pack-priv static int
public void
run()

Overrides java.lang.Thread.run.

Implements java.lang.Runnable.run.

This method is run by the thread when it executes.
pack-priv void
setLatch(CountDownLatch latch)

Used for testing purposes

pack-priv void
signalAlmostReadiness()

Signal another thread that we have established a connection This is useful for testing purposes.

public void
pack-priv static void
Inherited from java.lang.Thread:
activeCountcheckAccessclonecountStackFramescurrentThreaddumpStackenumerategetAllStackTracesgetContextClassLoadergetDefaultUncaughtExceptionHandlergetIdgetNamegetPrioritygetStackTracegetStategetThreadGroupgetUncaughtExceptionHandlerholdsLockinterruptinterruptedisAliveisDaemonisInterruptedisVirtualjoinjoinjoinjoinofPlatformofVirtualonSpinWaitresumesetContextClassLoadersetDaemonsetDefaultUncaughtExceptionHandlersetNamesetPrioritysetUncaughtExceptionHandlersleepsleepsleepstartstartVirtualThreadstopsuspendthreadIdtoStringyield

Field Detail

closedback to summary
private boolean closed
latchback to summary
private CountDownLatch latch
lcback to summary
private final LoggerContext lc
loggerback to summary
pack-priv Logger logger
portback to summary
private final int port
serverSocketback to summary
private ServerSocket serverSocket
socketNodeListback to summary
private List<SocketNode> socketNodeList

Constructor Detail

SimpleSocketServerback to summary
public SimpleSocketServer(LoggerContext lc, int port)

Method Detail

closeback to summary
public void close()
configureLCback to summary
public static void configureLC(LoggerContext lc, String configFile) throws JoranException
doMainback to summary
protected static void doMain(Class<? extends SimpleSocketServer> serverClass, String[] argv) throws Exception
getClientThreadNameback to summary
protected String getClientThreadName(Socket socket)

Returns a name to identify each client thread.

getLatchback to summary
public CountDownLatch getLatch()

Used for testing purposes

getServerSocketFactoryback to summary
protected ServerSocketFactory getServerSocketFactory()

Gets the platform default ServerSocketFactory.

Subclasses may override to provide a custom server socket factory.

getServerThreadNameback to summary
protected String getServerThreadName()

Returns the name given to the server thread.

isClosedback to summary
public boolean isClosed()
mainback to summary
public static void main(String[] argv) throws Exception
parsePortNumberback to summary
pack-priv static int parsePortNumber(String portStr)
runback to summary
public void run()

Overrides java.lang.Thread.run.

Implements java.lang.Runnable.run.

Doc from java.lang.Thread.run.

This method is run by the thread when it executes. Subclasses of Thread may override this method.

This method is not intended to be invoked directly. If this thread is a platform thread created with a Runnable task then invoking this method will invoke the task's run method. If this thread is a virtual thread then invoking this method directly does nothing.

setLatchback to summary
pack-priv void setLatch(CountDownLatch latch)

Used for testing purposes

signalAlmostReadinessback to summary
pack-priv void signalAlmostReadiness()

Signal another thread that we have established a connection This is useful for testing purposes.

socketNodeClosingback to summary
public void socketNodeClosing(SocketNode sn)
usageback to summary
pack-priv static void usage(String msg)