org.apache.logging.log4j.core.net
Class TCPSocketManager

java.lang.Object
  extended by org.apache.logging.log4j.core.appender.AbstractManager
      extended by org.apache.logging.log4j.core.appender.OutputStreamManager
          extended by org.apache.logging.log4j.core.net.AbstractSocketManager
              extended by org.apache.logging.log4j.core.net.TCPSocketManager

public class TCPSocketManager
extends AbstractSocketManager

Manager of TCP Socket connections.


Field Summary
static int DEFAULT_RECONNECTION_DELAY
          The default reconnection delay (30000 milliseconds or 30 seconds).
 
Fields inherited from class org.apache.logging.log4j.core.net.AbstractSocketManager
address, host, port
 
Fields inherited from class org.apache.logging.log4j.core.appender.AbstractManager
count, LOGGER
 
Constructor Summary
TCPSocketManager(String name, OutputStream os, Socket sock, InetAddress addr, String host, int port, int delay, boolean immediateFail)
          The Constructor.
 
Method Summary
protected  void close()
           
 Map<String,String> getContentFormat()
          TCPSocketManager's content format is specified by:

Key: "protocol" Value: "tcp"

Key: "direction" Value: "out"

static TCPSocketManager getSocketManager(String host, int port, int delay, boolean immediateFail)
          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, setFooter, setHeader, setOutputStream, write
 
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

public static final int DEFAULT_RECONNECTION_DELAY
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 addr,
                        String host,
                        int port,
                        int delay,
                        boolean immediateFail)
The Constructor.

Parameters:
name - The unique name of this connection.
os - The OutputStream.
sock - The Socket.
addr - The internet address of the host.
host - The name of the host.
port - The port number on the host.
delay - Reconnection interval.
Method Detail

getSocketManager

public static TCPSocketManager getSocketManager(String host,
                                                int port,
                                                int delay,
                                                boolean immediateFail)
Obtain a TCPSocketManager.

Parameters:
host - The host to connect to.
port - The port on the host.
delay - 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

getContentFormat

public Map<String,String> getContentFormat()
TCPSocketManager's content format is specified by:

Key: "protocol" Value: "tcp"

Key: "direction" Value: "out"

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


Copyright © 1999-2013 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.