ch.qos.logback.core.net
Class DefaultSocketConnector

java.lang.Object
  extended by ch.qos.logback.core.net.DefaultSocketConnector
All Implemented Interfaces:
SocketConnector, Callable<Socket>

public class DefaultSocketConnector
extends Object
implements SocketConnector

Default implementation of SocketConnector.

Since:
1.0.12
Author:
Carl Harris

Nested Class Summary
 
Nested classes/interfaces inherited from interface ch.qos.logback.core.net.SocketConnector
SocketConnector.ExceptionHandler
 
Constructor Summary
DefaultSocketConnector(InetAddress address, int port, DelayStrategy delayStrategy)
          Constructs a new connector.
DefaultSocketConnector(InetAddress address, int port, long initialDelay, long retryDelay)
          Constructs a new connector.
 
Method Summary
 Socket call()
          Loops until the desired connection is established and returns the resulting connector.
 void setExceptionHandler(SocketConnector.ExceptionHandler exceptionHandler)
          Sets the connector's exception handler.
 void setSocketFactory(SocketFactory socketFactory)
          Sets the connector's socket factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSocketConnector

public DefaultSocketConnector(InetAddress address,
                              int port,
                              long initialDelay,
                              long retryDelay)
Constructs a new connector.

Parameters:
address - address of remote listener
port - port of remote listener
initialDelay - delay before initial connection attempt
retryDelay - delay after failed connection attempt

DefaultSocketConnector

public DefaultSocketConnector(InetAddress address,
                              int port,
                              DelayStrategy delayStrategy)
Constructs a new connector.

Parameters:
address - address of remote listener
port - port of remote listener
delayStrategy - strategy for choosing the delay to impose before each connection attempt
Method Detail

call

public Socket call()
            throws InterruptedException
Loops until the desired connection is established and returns the resulting connector.

Specified by:
call in interface SocketConnector
Specified by:
call in interface Callable<Socket>
Returns:
the connected socket
Throws:
InterruptedException

setExceptionHandler

public void setExceptionHandler(SocketConnector.ExceptionHandler exceptionHandler)
Sets the connector's exception handler.

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

Specified by:
setExceptionHandler in interface SocketConnector
Parameters:
exceptionHandler - the handler to set

setSocketFactory

public void setSocketFactory(SocketFactory socketFactory)
Sets the connector's socket factory.

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

Specified by:
setSocketFactory in interface SocketConnector
Parameters:
socketFactory - the factory to set


Copyright © 2005-2014 QOS.ch. All Rights Reserved.