Package ch.qos.logback.core.net.server
Class AbstractServerSocketAppender<E>
- java.lang.Object
-
- ch.qos.logback.core.spi.ContextAwareBase
-
- ch.qos.logback.core.AppenderBase<E>
-
- ch.qos.logback.core.net.server.AbstractServerSocketAppender<E>
-
- All Implemented Interfaces:
Appender<E>,ContextAware,FilterAttachable<E>,LifeCycle
- Direct Known Subclasses:
ServerSocketAppender,ServerSocketAppender,SSLServerSocketAppenderBase
public abstract class AbstractServerSocketAppender<E> extends AppenderBase<E>
This is the super class for module specific ServerSocketAppender implementations can derive from.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Stringaddressprivate intbacklogprivate intclientQueueSizestatic intDEFAULT_BACKLOGDefaultServerSocketbacklogstatic intDEFAULT_CLIENT_QUEUE_SIZEDefault queue size used for each clientprivate intportprivate ServerRunner<RemoteReceiverClient>runner-
Fields inherited from class ch.qos.logback.core.AppenderBase
name, started
-
Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase
context
-
-
Constructor Summary
Constructors Constructor Description AbstractServerSocketAppender()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidappend(E event)protected ServerListener<RemoteReceiverClient>createServerListener(java.net.ServerSocket socket)protected ServerRunner<RemoteReceiverClient>createServerRunner(ServerListener<RemoteReceiverClient> listener, java.util.concurrent.Executor executor)java.lang.StringgetAddress()Gets the local address for the listener.intgetBacklog()Gets the listener queue depth.intgetClientQueueSize()Gets the event queue size used for each client connection.protected java.net.InetAddressgetInetAddress()Gets the local address for the listener.intgetPort()Gets the local port for the listener.protected abstract PreSerializationTransformer<E>getPST()Gets a transformer that will be used to convert a received event to aSerializableform.protected javax.net.ServerSocketFactorygetServerSocketFactory()Gets the factory used to createServerSocketobjects.protected abstract voidpostProcessEvent(E event)Post process an event received via#append(E).voidsetAddress(java.lang.String address)Sets the local address for the listener.voidsetBacklog(int backlog)Sets the listener queue depth.voidsetClientQueueSize(int clientQueueSize)Sets the event queue size used for each client connection.voidsetPort(int port)Sets the local port for the listener.voidstart()voidstop()-
Methods inherited from class ch.qos.logback.core.AppenderBase
addFilter, clearAllFilters, doAppend, getCopyOfAttachedFiltersList, getFilterChainDecision, getName, isStarted, setName, toString
-
Methods inherited from class ch.qos.logback.core.spi.ContextAwareBase
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContext
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ch.qos.logback.core.spi.ContextAware
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext
-
-
-
-
Field Detail
-
DEFAULT_BACKLOG
public static final int DEFAULT_BACKLOG
DefaultServerSocketbacklog- See Also:
- Constant Field Values
-
DEFAULT_CLIENT_QUEUE_SIZE
public static final int DEFAULT_CLIENT_QUEUE_SIZE
Default queue size used for each client- See Also:
- Constant Field Values
-
port
private int port
-
backlog
private int backlog
-
clientQueueSize
private int clientQueueSize
-
address
private java.lang.String address
-
runner
private ServerRunner<RemoteReceiverClient> runner
-
-
Method Detail
-
start
public void start()
- Specified by:
startin interfaceLifeCycle- Overrides:
startin classAppenderBase<E>
-
createServerListener
protected ServerListener<RemoteReceiverClient> createServerListener(java.net.ServerSocket socket)
-
createServerRunner
protected ServerRunner<RemoteReceiverClient> createServerRunner(ServerListener<RemoteReceiverClient> listener, java.util.concurrent.Executor executor)
-
stop
public void stop()
- Specified by:
stopin interfaceLifeCycle- Overrides:
stopin classAppenderBase<E>
-
append
protected void append(E event)
- Specified by:
appendin classAppenderBase<E>
-
postProcessEvent
protected abstract void postProcessEvent(E event)
Post process an event received via#append(E).- Parameters:
event-
-
getPST
protected abstract PreSerializationTransformer<E> getPST()
Gets a transformer that will be used to convert a received event to aSerializableform.- Returns:
-
getServerSocketFactory
protected javax.net.ServerSocketFactory getServerSocketFactory() throws java.lang.ExceptionGets the factory used to createServerSocketobjects.The default implementation delegates to
ServerSocketFactory.getDefault(). Subclasses may override to private a different socket factory implementation.- Returns:
- socket factory.
- Throws:
java.lang.Exception
-
getInetAddress
protected java.net.InetAddress getInetAddress() throws java.net.UnknownHostExceptionGets the local address for the listener.- Returns:
- an
InetAddressrepresentation of the local address. - Throws:
java.net.UnknownHostException
-
getPort
public int getPort()
Gets the local port for the listener.- Returns:
- local port
-
setPort
public void setPort(int port)
Sets the local port for the listener.- Parameters:
port- the local port to set
-
getBacklog
public int getBacklog()
Gets the listener queue depth.This represents the number of connected clients whose connections have not yet been accepted.
- Returns:
- queue depth
- See Also:
ServerSocket
-
setBacklog
public void setBacklog(int backlog)
Sets the listener queue depth.This represents the number of connected clients whose connections have not yet been accepted.
- Parameters:
backlog- the queue depth to set- See Also:
ServerSocket
-
getAddress
public java.lang.String getAddress()
Gets the local address for the listener.- Returns:
- a string representation of the local address
-
setAddress
public void setAddress(java.lang.String address)
Sets the local address for the listener.- Parameters:
address- a host name or a string representation of an IP address
-
getClientQueueSize
public int getClientQueueSize()
Gets the event queue size used for each client connection.- Returns:
- queue size
-
setClientQueueSize
public void setClientQueueSize(int clientQueueSize)
Sets the event queue size used for each client connection.- Parameters:
clientQueueSize- the queue size to set
-
-