Package ch.qos.logback.classic.net
Class SocketReceiver
- java.lang.Object
-
- ch.qos.logback.core.spi.ContextAwareBase
-
- ch.qos.logback.classic.net.ReceiverBase
-
- ch.qos.logback.classic.net.SocketReceiver
-
- All Implemented Interfaces:
SocketConnector.ExceptionHandler
,ContextAware
,LifeCycle
,java.lang.Runnable
- Direct Known Subclasses:
SSLSocketReceiver
public class SocketReceiver extends ReceiverBase implements java.lang.Runnable, SocketConnector.ExceptionHandler
A component that receives serializedILoggingEvent
objects from a remote appender over aSocket
.- Author:
- Carl Harris
-
-
Field Summary
-
Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase
context
-
-
Constructor Summary
Constructors Constructor Description SocketReceiver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
connectionFailed(SocketConnector connector, java.lang.Exception ex)
protected java.lang.Runnable
getRunnableTask()
Provides the runnable task this receiver will execute.protected javax.net.SocketFactory
getSocketFactory()
protected SocketConnector
newConnector(java.net.InetAddress address, int port, int initialDelay, int retryDelay)
protected void
onStop()
Allows a subclass to participate in receiver shutdown.void
run()
void
setAcceptConnectionTimeout(int acceptConnectionTimeout)
void
setPort(int port)
void
setReconnectionDelay(int reconnectionDelay)
void
setRemoteHost(java.lang.String remoteHost)
protected boolean
shouldStart()
Determines whether this receiver should start.-
Methods inherited from class ch.qos.logback.classic.net.ReceiverBase
isStarted, start, stop
-
Methods inherited from class ch.qos.logback.core.spi.ContextAwareBase
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContext
-
-
-
-
Method Detail
-
shouldStart
protected boolean shouldStart()
Determines whether this receiver should start.Subclasses will implement this method to do any subclass-specific validation. The subclass's
ReceiverBase.getRunnableTask()
method will be invoked (and the task returned will be submitted to the executor) if and only if this method returnstrue
- Specified by:
shouldStart
in classReceiverBase
- Returns:
- flag indicating whether this receiver should start
-
onStop
protected void onStop()
Allows a subclass to participate in receiver shutdown.- Specified by:
onStop
in classReceiverBase
-
getRunnableTask
protected java.lang.Runnable getRunnableTask()
Description copied from class:ReceiverBase
Provides the runnable task this receiver will execute.- Specified by:
getRunnableTask
in classReceiverBase
- Returns:
- runnable task
-
run
public void run()
- Specified by:
run
in interfacejava.lang.Runnable
-
connectionFailed
public void connectionFailed(SocketConnector connector, java.lang.Exception ex)
- Specified by:
connectionFailed
in interfaceSocketConnector.ExceptionHandler
-
newConnector
protected SocketConnector newConnector(java.net.InetAddress address, int port, int initialDelay, int retryDelay)
-
getSocketFactory
protected javax.net.SocketFactory getSocketFactory()
-
setRemoteHost
public void setRemoteHost(java.lang.String remoteHost)
-
setPort
public void setPort(int port)
-
setReconnectionDelay
public void setReconnectionDelay(int reconnectionDelay)
-
setAcceptConnectionTimeout
public void setAcceptConnectionTimeout(int acceptConnectionTimeout)
-
-