public class GelfTCPSender extends AbstractNioSender<java.nio.channels.SocketChannel> implements GelfSender
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CONNECTION_TIMEOUT |
static java.lang.String |
KEEPALIVE |
static java.lang.String |
MAX_WRITE_BACKOFF_TIME |
static java.lang.String |
READ_TIMEOUT |
static java.lang.String |
RETRIES |
static java.lang.String |
WRITE_BACKOFF_THRESHOLD |
static java.lang.String |
WRITE_BACKOFF_TIME |
INITIAL_BUFFER_SIZE, PROPERTY_BUFFER_SIZE| Constructor and Description |
|---|
GelfTCPSender(java.lang.String host,
int port,
int connectTimeoutMs,
int readTimeoutMs,
ErrorReporter errorReporter) |
GelfTCPSender(java.lang.String host,
int port,
int connectTimeoutMs,
int readTimeoutMs,
int deliveryAttempts,
boolean keepAlive,
biz.paluch.logging.gelf.intern.sender.BackOff backoff,
int writeBackoffThreshold,
ErrorReporter errorReporter) |
GelfTCPSender(java.lang.String host,
int port,
int connectTimeoutMs,
int readTimeoutMs,
int deliveryAttempts,
boolean keepAlive,
ErrorReporter errorReporter) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
connect() |
protected java.nio.channels.SocketChannel |
createSocketChannel(int readTimeoutMs,
boolean keepAlive) |
protected boolean |
isConnected(java.nio.channels.SocketChannel channel) |
boolean |
sendMessage(GelfMessage message)
Send the Gelf message.
|
protected void |
write(java.nio.ByteBuffer buffer) |
channel, close, getHost, getPort, isConnected, isShutdown, reportError, setChannelclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclosepublic static final java.lang.String CONNECTION_TIMEOUT
public static final java.lang.String READ_TIMEOUT
public static final java.lang.String RETRIES
public static final java.lang.String KEEPALIVE
public static final java.lang.String WRITE_BACKOFF_TIME
public static final java.lang.String WRITE_BACKOFF_THRESHOLD
public static final java.lang.String MAX_WRITE_BACKOFF_TIME
public GelfTCPSender(java.lang.String host,
int port,
int connectTimeoutMs,
int readTimeoutMs,
ErrorReporter errorReporter)
throws java.io.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.java.io.IOException - in case of I/O errorspublic GelfTCPSender(java.lang.String host,
int port,
int connectTimeoutMs,
int readTimeoutMs,
int deliveryAttempts,
boolean keepAlive,
ErrorReporter errorReporter)
throws java.io.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.java.io.IOException - in case of I/O errorspublic GelfTCPSender(java.lang.String host,
int port,
int connectTimeoutMs,
int readTimeoutMs,
int deliveryAttempts,
boolean keepAlive,
biz.paluch.logging.gelf.intern.sender.BackOff backoff,
int writeBackoffThreshold,
ErrorReporter errorReporter)
throws java.io.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.backoff - Backoff strategy to activate if a socket sender buffer is full and several attempts to write to the socket are unsuccessful due to it.writeBackoffThreshold - attempts to write to a socket before a backoff will be activated.errorReporter - the error reporter, must not be null.java.io.IOException - in case of I/O errorsprotected java.nio.channels.SocketChannel createSocketChannel(int readTimeoutMs,
boolean keepAlive)
throws java.io.IOException
java.io.IOExceptionpublic boolean sendMessage(GelfMessage message)
GelfSendersendMessage in interface GelfSendermessage - the messageprotected void write(java.nio.ByteBuffer buffer)
throws java.io.IOException,
java.lang.InterruptedException
java.io.IOExceptionjava.lang.InterruptedExceptionprotected boolean connect()
throws java.io.IOException
java.io.IOExceptionprotected boolean isConnected(java.nio.channels.SocketChannel channel)
isConnected in class AbstractNioSender<java.nio.channels.SocketChannel>Copyright © 2013-2022. All Rights Reserved.