Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.logging.log4j.core.net
Class TcpSocketManager

    java.lang.Object
      org.apache.logging.log4j.core.appender.AbstractManager
          org.apache.logging.log4j.core.appender.OutputStreamManager
              org.apache.logging.log4j.core.net.AbstractSocketManager
                  org.apache.logging.log4j.core.net.TcpSocketManager

Direct Known Subclasses:
  SslSocketManager

    public class TcpSocketManager

extends AbstractSocketManager

Manager of TCP Socket connections.

Nested Class Summary
`protected static class` | `TcpSocketManager.TcpSocketManagerFactory` Factory to create a TcpSocketManager.

Field Summary
`static int` | `DEFAULT_RECONNECTION_DELAY_MILLIS` The default reconnection delay (30000 milliseconds or 30 seconds).

Fields inherited from class org.apache.logging.log4j.core.net.AbstractSocketManager
`host, inetAddress, port`

Fields inherited from class org.apache.logging.log4j.core.appender.OutputStreamManager
`layout`

Fields inherited from class org.apache.logging.log4j.core.appender.AbstractManager
`count, LOGGER`

Constructor Summary
`TcpSocketManager(String name, OutputStream os, Socket sock, InetAddress inetAddress, String host, int port, int connectTimeoutMillis, int delay, boolean immediateFail, Layout<? extends Serializable> layout)` The Constructor.

Method Summary
`protected void` | `close()`
`protected Socket` | `createSocket(InetAddress host, int port)`
`protected Socket` | `createSocket(String host, int port)`
`int` | `getConnectTimeoutMillis()`
`Map<String,String>` | `getContentFormat()` Gets this TcpSocketManager's content format.
`static TcpSocketManager` | `getSocketManager(String host, int port, int connectTimeoutMillis, int delayMillis, boolean immediateFail, Layout<? extends Serializable> layout)` Obtain a TcpSocketManager.
`protected void` | `write(byte[] bytes, int offset, int length)` Some output streams synchronize writes while others do not.

Methods inherited from class org.apache.logging.log4j.core.appender.OutputStreamManager
`flush, getManager, getOutputStream, isOpen, releaseSub, setOutputStream, write, writeFooter`

Methods inherited from class org.apache.logging.log4j.core.appender.AbstractManager
`getCount, getName, hasManager, release`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_RECONNECTION_DELAY_MILLIS

    public static final int DEFAULT_RECONNECTION_DELAY_MILLIS

  The default reconnection delay (30000 milliseconds or 30 seconds).

  See Also:
    Constant Field Values

Constructor Detail

### TcpSocketManager

    public TcpSocketManager(String name,
                            OutputStream os,
                            Socket sock,
                            InetAddress inetAddress,
                            String host,
                            int port,
                            int connectTimeoutMillis,
                            int delay,
                            boolean immediateFail,
                            Layout<? extends Serializable> layout)

  The Constructor.

  Parameters:
    `name` - The unique name of this connection.
    `os` - The OutputStream.
    `sock` - The Socket.
    `inetAddress` - The Internet address of the host.
    `host` - The name of the host.
    `port` - The port number on the host.
    `connectTimeoutMillis` - the connect timeout in milliseconds.
    `delay` - Reconnection interval.
    `immediateFail` -
    `layout` - The Layout.

Method Detail

### getSocketManager

    public static TcpSocketManager getSocketManager(String host,
                                                    int port,
                                                    int connectTimeoutMillis,
                                                    int delayMillis,
                                                    boolean immediateFail,
                                                    Layout<? extends Serializable> layout)

  Obtain a TcpSocketManager.

  Parameters:
    `host` - The host to connect to.
    `port` - The port on the host.
    `connectTimeoutMillis` - the connect timeout in milliseconds
    `delayMillis` - The interval to pause between retries.
  Returns:
    A TcpSocketManager.

### write

    protected void write(byte[] bytes,
                         int offset,
                         int length)

  Description copied from class: `OutputStreamManager`
  Some output streams synchronize writes while others do not. Synchronizing here insures that log events won't be intertwined.

  Overrides:
    `write` in class `OutputStreamManager`
  Parameters:
    `bytes` - The serialized Log event.
    `offset` - The offset into the byte array.
    `length` - The number of bytes to write.

### close

    protected void close()

  Overrides:
    `close` in class `OutputStreamManager`

### getConnectTimeoutMillis

    public int getConnectTimeoutMillis()

### getContentFormat

    public Map<String,String> getContentFormat()

  Gets this TcpSocketManager's content format. Specified by:
  - Key: "protocol" Value: "tcp"
  - Key: "direction" Value: "out"

  Overrides:
    `getContentFormat` in class `AbstractSocketManager`
  Returns:
    Map of content format keys supporting TcpSocketManager

### createSocket

    protected Socket createSocket(InetAddress host,
                                  int port)
                           throws IOException

  Throws:
    `IOException`

### createSocket

    protected Socket createSocket(String host,
                                  int port)
                           throws IOException

  Throws:
    `IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 1999-2015 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.