public class TcpSocketManager extends AbstractSocketManager
Modifier and Type | Class and Description |
---|---|
protected static class |
TcpSocketManager.TcpSocketManagerFactory
Factory to create a TcpSocketManager.
|
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_RECONNECTION_DELAY_MILLIS
The default reconnection delay (30000 milliseconds or 30 seconds).
|
host, inetAddress, port
layout
count, LOGGER
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
flush, getManager, getOutputStream, isOpen, releaseSub, setOutputStream, write, writeFooter
getCount, getName, hasManager, release
public static final int DEFAULT_RECONNECTION_DELAY_MILLIS
public TcpSocketManager(String name, OutputStream os, Socket sock, InetAddress inetAddress, String host, int port, int connectTimeoutMillis, int delay, boolean immediateFail, Layout<? extends Serializable> layout)
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.public static TcpSocketManager getSocketManager(String host, int port, int connectTimeoutMillis, int delayMillis, boolean immediateFail, Layout<? extends Serializable> layout)
host
- The host to connect to.port
- The port on the host.connectTimeoutMillis
- the connect timeout in millisecondsdelayMillis
- The interval to pause between retries.protected void write(byte[] bytes, int offset, int length)
OutputStreamManager
write
in class OutputStreamManager
bytes
- The serialized Log event.offset
- The offset into the byte array.length
- The number of bytes to write.protected void close()
close
in class OutputStreamManager
public int getConnectTimeoutMillis()
public Map<String,String> getContentFormat()
getContentFormat
in class AbstractSocketManager
protected Socket createSocket(InetAddress host, int port) throws IOException
IOException
protected Socket createSocket(String host, int port) throws IOException
IOException
Copyright © 1999-2021 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.