Package ch.qos.logback.classic.net
Class SimpleSocketServer
java.lang.Object
java.lang.Thread
ch.qos.logback.classic.net.SimpleSocketServer
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
SimpleSSLSocketServer
A simple
SocketNode
based server.
<b>Usage:</b> java ch.qos.logback.classic.net.SimpleSocketServer port configFilewhere port is a port number where the server listens and configFile is an xml configuration file fed to
JoranConfigurator
.
- Since:
- 0.8.4
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private CountDownLatch
private final LoggerContext
(package private) org.slf4j.Logger
private final int
private ServerSocket
private List
<SocketNode> Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
static void
configureLC
(LoggerContext lc, String configFile) protected static void
doMain
(Class<? extends SimpleSocketServer> serverClass, String[] argv) protected String
getClientThreadName
(Socket socket) Returns a name to identify each client thread.getLatch()
Used for testing purposesprotected ServerSocketFactory
Gets the platform defaultServerSocketFactory
.protected String
Returns the name given to the server thread.boolean
isClosed()
static void
(package private) static int
parsePortNumber
(String portStr) void
run()
(package private) void
setLatch
(CountDownLatch latch) Used for testing purposes(package private) void
Signal another thread that we have established a connection This is useful for testing purposes.void
(package private) static void
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
-
Field Details
-
logger
org.slf4j.Logger logger -
port
private final int port -
lc
-
closed
private boolean closed -
serverSocket
-
socketNodeList
-
latch
-
-
Constructor Details
-
SimpleSocketServer
-
-
Method Details
-
main
- Throws:
Exception
-
doMain
protected static void doMain(Class<? extends SimpleSocketServer> serverClass, String[] argv) throws Exception - Throws:
Exception
-
run
public void run() -
getServerThreadName
Returns the name given to the server thread. -
getClientThreadName
Returns a name to identify each client thread. -
getServerSocketFactory
Gets the platform defaultServerSocketFactory
.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
Used for testing purposes- Parameters:
latch
-
-
getLatch
Used for testing purposes -
isClosed
public boolean isClosed() -
close
public void close() -
socketNodeClosing
-
usage
-
parsePortNumber
-
configureLC
- Throws:
JoranException
-