Top Description Inners Fields Constructors Methods
ch.qos.logback.core.net

public Class DefaultSocketConnector

extends Object
implements SocketConnector
Class Inheritance
All Implemented Interfaces
ch.qos.logback.core.net.SocketConnector, java.util.concurrent.Callable
Imports
java.io.IOException, java.net.InetAddress, .Socket, javax.net.SocketFactory, ch.qos.logback.core.util.DelayStrategy, .FixedDelay

Default implementation of SocketConnector.
Author
Carl Harris
Since
1.0.12

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final InetAddress
private final DelayStrategy
private SocketConnector.ExceptionHandler
private final int
private SocketFactory

Constructor Summary

AccessConstructor and Description
public
DefaultSocketConnector(InetAddress
address of remote listener
address
,
int
port of remote listener
port
,
long
delay before initial connection attempt
initialDelay
,
long
delay after failed connection attempt
retryDelay
)

Constructs a new connector.

public
DefaultSocketConnector(InetAddress
address of remote listener
address
,
int
port of remote listener
port
,
DelayStrategy
strategy for choosing the delay to impose before each connection attempt
delayStrategy
)

Constructs a new connector.

Method Summary

Modifier and TypeMethod and Description
public Socket
call()

Implements ch.qos.logback.core.net.SocketConnector.call.

Loops until the desired connection is established and returns the resulting connector.
private Socket
public void
setExceptionHandler(SocketConnector.ExceptionHandler
the handler to set
exceptionHandler
)

Implements ch.qos.logback.core.net.SocketConnector.setExceptionHandler.

Sets the connector's exception handler.
public void
setSocketFactory(SocketFactory
the factory to set
socketFactory
)

Implements ch.qos.logback.core.net.SocketConnector.setSocketFactory.

Sets the connector's socket factory.
private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

addressback to summary
private final InetAddress address
delayStrategyback to summary
private final DelayStrategy delayStrategy
exceptionHandlerback to summary
private SocketConnector.ExceptionHandler exceptionHandler
portback to summary
private final int port
socketFactoryback to summary
private SocketFactory socketFactory

Constructor Detail

DefaultSocketConnectorback to summary
public DefaultSocketConnector(InetAddress address, int port, long initialDelay, long retryDelay)

Constructs a new connector.

Parameters
address:InetAddress

address of remote listener

port:int

port of remote listener

initialDelay:long

delay before initial connection attempt

retryDelay:long

delay after failed connection attempt

DefaultSocketConnectorback to summary
public DefaultSocketConnector(InetAddress address, int port, DelayStrategy delayStrategy)

Constructs a new connector.

Parameters
address:InetAddress

address of remote listener

port:int

port of remote listener

delayStrategy:DelayStrategy

strategy for choosing the delay to impose before each connection attempt

Method Detail

callback to summary
public Socket call() throws InterruptedException

Implements ch.qos.logback.core.net.SocketConnector.call.

Loops until the desired connection is established and returns the resulting connector.

Returns:Socket

Doc from ch.qos.logback.core.net.SocketConnector.call.

the connected socket

createSocketback to summary
private Socket createSocket()
setExceptionHandlerback to summary
public void setExceptionHandler(SocketConnector.ExceptionHandler exceptionHandler)

Implements ch.qos.logback.core.net.SocketConnector.setExceptionHandler.

Doc from ch.qos.logback.core.net.SocketConnector.setExceptionHandler.

Sets the connector's exception handler.

The handler must be set before the call() method is invoked.

Parameters
exceptionHandler:SocketConnector.ExceptionHandler

the handler to set

setSocketFactoryback to summary
public void setSocketFactory(SocketFactory socketFactory)

Implements ch.qos.logback.core.net.SocketConnector.setSocketFactory.

Doc from ch.qos.logback.core.net.SocketConnector.setSocketFactory.

Sets the connector's socket factory.

If no factory is configured that connector will use the platform's default factory.

Parameters
socketFactory:SocketFactory

the factory to set

useDefaultsForMissingFieldsback to summary
private void useDefaultsForMissingFields()
ch.qos.logback.core.net back to summary

private Class DefaultSocketConnector.ConsoleExceptionHandler

extends Object
implements ExceptionHandler
Class Inheritance
  • java.lang.Object
  • ch.qos.logback.core.net.DefaultSocketConnector.ConsoleExceptionHandler
All Implemented Interfaces
ch.qos.logback.core.net.SocketConnector.ExceptionHandler

A default ExceptionHandler that writes to System.out

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ConsoleExceptionHandlerback to summary
private ConsoleExceptionHandler()

Method Detail

connectionFailedback to summary
public void connectionFailed(SocketConnector connector, Exception ex)

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