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

public Class SocketReceiver

extends ReceiverBase
implements Runnable, ExceptionHandler
Class Inheritance
All Implemented Interfaces
ch.qos.logback.core.net.SocketConnector.ExceptionHandler, java.lang.Runnable
Known Direct Subclasses
ch.qos.logback.classic.net.SSLSocketReceiver
Imports
java.io.EOFException, .IOException, .ObjectInputStream, java.net.ConnectException, .InetAddress, .Socket, .UnknownHostException, java.util.concurrent.ExecutionException, .Future, .RejectedExecutionException, javax.net.SocketFactory, ch.qos.logback.classic.Logger, .LoggerContext, ch.qos.logback.classic.net.server.HardenedLoggingEventInputStream, ch.qos.logback.classic.spi.ILoggingEvent, ch.qos.logback.core.net.DefaultSocketConnector, .AbstractSocketAppender, .SocketConnector, ch.qos.logback.core.util.CloseUtil

A component that receives serialized ILoggingEvent objects from a remote appender over a Socket.
Author
Carl Harris

Field Summary

Modifier and TypeField and Description
private int
private InetAddress
private Future<Socket>
private static final int
private int
private String
private int
private String
private volatile Socket

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private Future<Socket>
public void
private SocketConnector
createConnector(InetAddress address, int port, int initialDelay, int retryDelay)

private void
protected Runnable
getRunnableTask()

Implements abstract ch.qos.logback.classic.net.ReceiverBase.getRunnableTask.

Provides the runnable task this receiver will execute.
protected SocketFactory
protected SocketConnector
newConnector(InetAddress address, int port, int initialDelay, int retryDelay)

protected void
onStop()

Implements abstract ch.qos.logback.classic.net.ReceiverBase.onStop.

Allows a subclass to participate in receiver shutdown.
public void
run()

Implements java.lang.Runnable.run.

Runs this operation.
public void
setAcceptConnectionTimeout(int acceptConnectionTimeout)

public void
setPort(int port)

public void
setReconnectionDelay(int reconnectionDelay)

public void
setRemoteHost(String remoteHost)

protected boolean
shouldStart()

Implements abstract ch.qos.logback.classic.net.ReceiverBase.shouldStart.

Determines whether this receiver should start.
private Socket
Inherited from ch.qos.logback.classic.net.ReceiverBase:
isStartedstartstop

Field Detail

acceptConnectionTimeoutback to summary
private int acceptConnectionTimeout
addressback to summary
private InetAddress address
connectorTaskback to summary
private Future<Socket> connectorTask
DEFAULT_ACCEPT_CONNECTION_DELAYback to summary
private static final int DEFAULT_ACCEPT_CONNECTION_DELAY
portback to summary
private int port
receiverIdback to summary
private String receiverId
reconnectionDelayback to summary
private int reconnectionDelay
remoteHostback to summary
private String remoteHost
socketback to summary
private volatile Socket socket

Constructor Detail

SocketReceiverback to summary
public SocketReceiver()

Method Detail

activateConnectorback to summary
private Future<Socket> activateConnector(SocketConnector connector)
connectionFailedback to summary
public void connectionFailed(SocketConnector connector, Exception ex)

Implements ch.qos.logback.core.net.SocketConnector.ExceptionHandler.connectionFailed.

createConnectorback to summary
private SocketConnector createConnector(InetAddress address, int port, int initialDelay, int retryDelay)
dispatchEventsback to summary
private void dispatchEvents(LoggerContext lc)
getRunnableTaskback to summary
protected Runnable getRunnableTask()

Implements abstract ch.qos.logback.classic.net.ReceiverBase.getRunnableTask.

Doc from ch.qos.logback.classic.net.ReceiverBase.getRunnableTask.

Provides the runnable task this receiver will execute.

Returns:Runnable

runnable task

Annotations
@Override
getSocketFactoryback to summary
protected SocketFactory getSocketFactory()
newConnectorback to summary
protected SocketConnector newConnector(InetAddress address, int port, int initialDelay, int retryDelay)
onStopback to summary
protected void onStop()

Implements abstract ch.qos.logback.classic.net.ReceiverBase.onStop.

Doc from ch.qos.logback.classic.net.ReceiverBase.onStop.

Allows a subclass to participate in receiver shutdown.

runback to summary
public void run()

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.

setAcceptConnectionTimeoutback to summary
public void setAcceptConnectionTimeout(int acceptConnectionTimeout)
setPortback to summary
public void setPort(int port)
setReconnectionDelayback to summary
public void setReconnectionDelay(int reconnectionDelay)
setRemoteHostback to summary
public void setRemoteHost(String remoteHost)
shouldStartback to summary
protected boolean shouldStart()

Implements abstract ch.qos.logback.classic.net.ReceiverBase.shouldStart.

Doc from ch.qos.logback.classic.net.ReceiverBase.shouldStart.

Determines whether this receiver should start.

Subclasses will implement this method to do any subclass-specific validation. The subclass's getRunnableTask() method will be invoked (and the task returned will be submitted to the executor) if and only if this method returns true

Returns:boolean

flag indicating whether this receiver should start

waitForConnectorToReturnASocketback to summary
private Socket waitForConnectorToReturnASocket() throws InterruptedException