public class GelfTCPSender extends AbstractNioSender<SocketChannel> implements GelfSender
| Modifier and Type | Field and Description |
|---|---|
static String |
CONNECTION_TIMEOUT |
static String |
KEEPALIVE |
static String |
READ_TIMEOUT |
static String |
RETRIES |
INITIAL_BUFFER_SIZE, PROPERTY_BUFFER_SIZE| Constructor and Description |
|---|
GelfTCPSender(String host,
int port,
int connectTimeoutMs,
int readTimeoutMs,
ErrorReporter errorReporter) |
GelfTCPSender(String host,
int port,
int connectTimeoutMs,
int readTimeoutMs,
int deliveryAttempts,
boolean keepAlive,
ErrorReporter errorReporter) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
connect() |
protected SocketChannel |
createSocketChannel(int readTimeoutMs,
boolean keepAlive) |
protected boolean |
isConnected(SocketChannel channel) |
boolean |
sendMessage(GelfMessage message)
Send the Gelf message.
|
protected void |
write(ByteBuffer buffer) |
channel, close, getHost, getPort, isConnected, isShutdown, reportError, setChannelclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclosepublic static final String CONNECTION_TIMEOUT
public static final String READ_TIMEOUT
public static final String RETRIES
public static final String KEEPALIVE
public GelfTCPSender(String host, int port, int connectTimeoutMs, int readTimeoutMs, ErrorReporter errorReporter) throws IOException
host - the host, must not be null.port - the port.connectTimeoutMs - connection timeout, in TimeUnit.MILLISECONDS.readTimeoutMs - read timeout, in TimeUnit.MILLISECONDS.errorReporter - the error reporter, must not be null.IOException - in case of I/O errorspublic GelfTCPSender(String host, int port, int connectTimeoutMs, int readTimeoutMs, int deliveryAttempts, boolean keepAlive, ErrorReporter errorReporter) throws IOException
host - the host, must not be null.port - the port.connectTimeoutMs - connection timeout, in TimeUnit.MILLISECONDS.readTimeoutMs - read timeout, in TimeUnit.MILLISECONDS.deliveryAttempts - number of delivery attempts.keepAlive - true to enable TCP keep-alive.errorReporter - the error reporter, must not be null.IOException - in case of I/O errorsprotected SocketChannel createSocketChannel(int readTimeoutMs, boolean keepAlive) throws IOException
IOExceptionpublic boolean sendMessage(GelfMessage message)
GelfSendersendMessage in interface GelfSendermessage - the messageprotected void write(ByteBuffer buffer) throws IOException
IOExceptionprotected boolean connect()
throws IOException
IOExceptionprotected boolean isConnected(SocketChannel channel)
isConnected in class AbstractNioSender<SocketChannel>Copyright © 2013-2016. All Rights Reserved.