code stringlengths 23 201k | docstring stringlengths 17 96.2k | func_name stringlengths 0 235 | language stringclasses 1
value | repo stringlengths 8 72 | path stringlengths 11 317 | url stringlengths 57 377 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
public static boolean usePooling() {
return STATIC_POOLING || USE_POOLING_VAL.equalsIgnoreCase("true");
} | @return {@literal true} if pooling (static/instance-held pools) is enabled. | usePooling | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/PoolingGelfMessageBuilder.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/PoolingGelfMessageBuilder.java | MIT |
public GelfMessageBuilder recycle() {
version = GelfMessage.GELF_VERSION;
host = null;
shortMessage = null;
fullMessage = null;
javaTimestamp = 0;
level = null;
facility = GelfMessage.DEFAULT_FACILITY;
maximumMessageSize = GelfMessage.DEFAULT_MESSAGE_SIZE... | Recycle this {@link GelfMessageBuilder} to a default state.
@return {@code this} {@link GelfMessageBuilder} | recycle | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/PoolingGelfMessageBuilder.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/PoolingGelfMessageBuilder.java | MIT |
@Override
public GelfMessage build() {
GelfMessage gelfMessage = new PoolingGelfMessage(shortMessage, fullMessage, javaTimestamp, level, poolHolder);
gelfMessage.addFields(additionalFields);
gelfMessage.setMaximumMessageSize(maximumMessageSize);
gelfMessage.setVersion(version);
... | Build a new Gelf message based on the builder settings.
@return GelfMessage | build | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/PoolingGelfMessageBuilder.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/PoolingGelfMessageBuilder.java | MIT |
@Override
public synchronized void write(byte[] buf, int off, int len) throws IOException {
super.write(buf, off, len);
crc.update(buf, off, len);
} | Writes array of bytes to the compressed output stream. This method will block until all the bytes are written.
@param buf the data to be written
@param off the start offset of the data
@param len the length of the data
@exception IOException If an I/O error has occurred. | write | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/ReusableGzipOutputStream.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/ReusableGzipOutputStream.java | MIT |
@Override
public void finish() throws IOException {
if (!def.finished()) {
def.finish();
while (!def.finished()) {
int len = def.deflate(buf, 0, buf.length);
if (def.finished() && len <= buf.length - TRAILER_SIZE) {
// last deflater... | Finishes writing compressed data to the output stream without closing the underlying stream. Use this method when
applying multiple filters in succession to the same output stream.
@exception IOException if an I/O error has occurred | finish | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/ReusableGzipOutputStream.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/ReusableGzipOutputStream.java | MIT |
public void writeHeader() throws IOException {
out.write(new byte[] { (byte) GZIP_MAGIC, // Magic number (short)
(byte) (GZIP_MAGIC >> 8), // Magic number (short)
Deflater.DEFLATED, // Compression method (CM)
0, // Flags (FLG)
0, // Modification ti... | Finishes writing compressed data to the output stream without closing the underlying stream. Use this method when
applying multiple filters in succession to the same output stream.
@exception IOException if an I/O error has occurred | writeHeader | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/ReusableGzipOutputStream.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/ReusableGzipOutputStream.java | MIT |
private void writeTrailer(byte[] buf, int offset) {
writeInt((int) crc.getValue(), buf, offset); // CRC-32 of uncompr. data
writeInt(def.getTotalIn(), buf, offset + 4); // Number of uncompr. bytes
} | Finishes writing compressed data to the output stream without closing the underlying stream. Use this method when
applying multiple filters in succession to the same output stream.
@exception IOException if an I/O error has occurred | writeTrailer | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/ReusableGzipOutputStream.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/ReusableGzipOutputStream.java | MIT |
private void writeInt(int i, byte[] buf, int offset) {
writeShort(i & 0xffff, buf, offset);
writeShort((i >> 16) & 0xffff, buf, offset + 2);
} | Finishes writing compressed data to the output stream without closing the underlying stream. Use this method when
applying multiple filters in succession to the same output stream.
@exception IOException if an I/O error has occurred | writeInt | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/ReusableGzipOutputStream.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/ReusableGzipOutputStream.java | MIT |
private void writeShort(int s, byte[] buf, int offset) {
buf[offset] = (byte) (s & 0xff);
buf[offset + 1] = (byte) ((s >> 8) & 0xff);
} | Finishes writing compressed data to the output stream without closing the underlying stream. Use this method when
applying multiple filters in succession to the same output stream.
@exception IOException if an I/O error has occurred | writeShort | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/ReusableGzipOutputStream.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/ReusableGzipOutputStream.java | MIT |
public void reset() {
crc.reset();
def.reset();
} | Finishes writing compressed data to the output stream without closing the underlying stream. Use this method when
applying multiple filters in succession to the same output stream.
@exception IOException if an I/O error has occurred | reset | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/ReusableGzipOutputStream.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/ReusableGzipOutputStream.java | MIT |
static Result discover(String value) {
long len = value.length();
if (len == 0 || len > 32) {
return Result.STRING;
}
char firstChar = value.charAt(0);
if (firstChar < '0' || firstChar > '9') { // Possible leading "+" or "-"
if (firstChar == 'N' && len =... | Data type discovery for {@link String} value types. Discovers an indicator whether a type is a {@link Result#LONG}, a
{@link Result#DOUBLE} or {@link Result#STRING} type.
@author <a href="mailto:mpaluch@paluch.biz">Mark Paluch</a>
@author Wolfgang Jung | discover | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/ValueDiscovery.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/ValueDiscovery.java | MIT |
protected boolean isConnected() throws IOException {
ByteBuffer byteBuffer = readBuffers.get();
byteBuffer.clear();
T myChannel = channel();
if (myChannel != null && myChannel.isOpen() && isConnected(myChannel)) {
try {
return myChannel.read(byteBuffer) >=... | Create a new {@link AbstractNioSender} given {@link ErrorReporter}, {@code host} and {@code port}. Object creation
triggers hostname lookup for early failure.
@param errorReporter the error reporter.
@param host hostname.
@param port port number.
@exception UnknownHostException if no IP address for the {@code host} co... | isConnected | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/AbstractNioSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/AbstractNioSender.java | MIT |
protected T channel() {
return channel;
} | Create a new {@link AbstractNioSender} given {@link ErrorReporter}, {@code host} and {@code port}. Object creation
triggers hostname lookup for early failure.
@param errorReporter the error reporter.
@param host hostname.
@param port port number.
@exception UnknownHostException if no IP address for the {@code host} co... | channel | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/AbstractNioSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/AbstractNioSender.java | MIT |
public String getHost() {
return host;
} | Create a new {@link AbstractNioSender} given {@link ErrorReporter}, {@code host} and {@code port}. Object creation
triggers hostname lookup for early failure.
@param errorReporter the error reporter.
@param host hostname.
@param port port number.
@exception UnknownHostException if no IP address for the {@code host} co... | getHost | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/AbstractNioSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/AbstractNioSender.java | MIT |
public int getPort() {
return port;
} | Create a new {@link AbstractNioSender} given {@link ErrorReporter}, {@code host} and {@code port}. Object creation
triggers hostname lookup for early failure.
@param errorReporter the error reporter.
@param host hostname.
@param port port number.
@exception UnknownHostException if no IP address for the {@code host} co... | getPort | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/AbstractNioSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/AbstractNioSender.java | MIT |
public void close() {
shutdown = true;
Closer.close(channel());
} | Create a new {@link AbstractNioSender} given {@link ErrorReporter}, {@code host} and {@code port}. Object creation
triggers hostname lookup for early failure.
@param errorReporter the error reporter.
@param host hostname.
@param port port number.
@exception UnknownHostException if no IP address for the {@code host} co... | close | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/AbstractNioSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/AbstractNioSender.java | MIT |
public boolean isShutdown() {
return shutdown;
} | Create a new {@link AbstractNioSender} given {@link ErrorReporter}, {@code host} and {@code port}. Object creation
triggers hostname lookup for early failure.
@param errorReporter the error reporter.
@param host hostname.
@param port port number.
@exception UnknownHostException if no IP address for the {@code host} co... | isShutdown | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/AbstractNioSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/AbstractNioSender.java | MIT |
@Override
public void reportError(String message, Exception e) {
errorReporter.reportError(message, e);
} | Create a new {@link AbstractNioSender} given {@link ErrorReporter}, {@code host} and {@code port}. Object creation
triggers hostname lookup for early failure.
@param errorReporter the error reporter.
@param host hostname.
@param port port number.
@exception UnknownHostException if no IP address for the {@code host} co... | reportError | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/AbstractNioSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/AbstractNioSender.java | MIT |
public void setChannel(T channel) {
this.channel = channel;
} | Create a new {@link AbstractNioSender} given {@link ErrorReporter}, {@code host} and {@code port}. Object creation
triggers hostname lookup for early failure.
@param errorReporter the error reporter.
@param host hostname.
@param port port number.
@exception UnknownHostException if no IP address for the {@code host} co... | setChannel | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/AbstractNioSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/AbstractNioSender.java | MIT |
public static String encodeString(String s) {
return new String(encode(s.getBytes()));
} | Encodes a string into Base64 format. No blanks or line breaks are inserted.
@param s A String to be encoded.
@return A String containing the Base64 encoded data. | encodeString | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/Base64Coder.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/Base64Coder.java | MIT |
public static char[] encode(byte[] in) {
return encode(in, 0, in.length);
} | Encodes a byte array into Base64 format. No blanks or line breaks are inserted in the output.
@param in An array containing the data bytes to be encoded.
@return A character array containing the Base64 encoded data. | encode | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/Base64Coder.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/Base64Coder.java | MIT |
public static char[] encode(byte[] in, int iOff, int iLen) {
int oDataLen = (iLen * 4 + 2) / 3; // output length without padding
int oLen = ((iLen + 2) / 3) * 4; // output length including padding
char[] out = new char[oLen];
int ip = iOff;
int iEnd = iOff + iLen;
int op ... | Encodes a byte array into Base64 format. No blanks or line breaks are inserted in the output.
@param in An array containing the data bytes to be encoded.
@param iOff Offset of the first byte in <code>in</code> to be processed.
@param iLen Number of bytes to process in <code>in</code>, starting at <code>iOff</code>.
@r... | encode | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/Base64Coder.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/Base64Coder.java | MIT |
@Override
public long nextBackOff() {
return backoffTimeMs;
} | Constant {@link BackOff} implementation.
@author Mark Paluch | nextBackOff | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/ConstantBackOff.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/ConstantBackOff.java | MIT |
@Override
public BackOffExecution start() {
return this;
} | Constant {@link BackOff} implementation.
@author Mark Paluch | start | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/ConstantBackOff.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/ConstantBackOff.java | MIT |
protected static ByteBuffer[] toUDPBuffers(GelfMessage message, ThreadLocal<ByteBuffer> writeBuffers,
ThreadLocal<ByteBuffer> tempBuffers) {
while (true) {
try {
return message.toUDPBuffers(getBuffer(writeBuffers), getBuffer(tempBuffers));
} catch (BufferOve... | Create UDP buffers and apply auto-buffer-enlarging, if necessary.
@param message
@param writeBuffers
@param tempBuffers
@return | toUDPBuffers | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/GelfBuffers.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfBuffers.java | MIT |
protected static ByteBuffer toTCPBuffer(GelfMessage message, ThreadLocal<ByteBuffer> writeBuffers) {
while (true) {
try {
return message.toTCPBuffer(getBuffer(writeBuffers));
} catch (BufferOverflowException e) {
enlargeBuffer(writeBuffers);
... | Create TCP buffer and apply auto-buffer-enlarging, if necessary.
@param message
@param writeBuffers
@return | toTCPBuffer | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/GelfBuffers.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfBuffers.java | MIT |
private static void enlargeBuffer(ThreadLocal<ByteBuffer> buffers) {
ByteBuffer newBuffer = ByteBuffer.allocateDirect(calculateNewBufferSize(buffers.get().capacity()));
buffers.set(newBuffer);
} | Create TCP buffer and apply auto-buffer-enlarging, if necessary.
@param message
@param writeBuffers
@return | enlargeBuffer | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/GelfBuffers.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfBuffers.java | MIT |
private static ByteBuffer getBuffer(ThreadLocal<ByteBuffer> buffers) {
return (ByteBuffer) buffers.get().clear();
} | Create TCP buffer and apply auto-buffer-enlarging, if necessary.
@param message
@param writeBuffers
@return | getBuffer | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/GelfBuffers.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfBuffers.java | MIT |
private static int calculateNewBufferSize(int capacity) {
return (int) (capacity * 1.5);
} | Create TCP buffer and apply auto-buffer-enlarging, if necessary.
@param message
@param writeBuffers
@return | calculateNewBufferSize | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/GelfBuffers.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfBuffers.java | MIT |
@Override
public boolean sendMessage(GelfMessage message) {
HttpURLConnection connection = null;
try {
connection = (HttpURLConnection) url.openConnection();
connection.setConnectTimeout(connectTimeoutMs);
connection.setReadTimeout(readTimeoutMs);
c... | Create a new {@link GelfHTTPSender} given {@code url}, {@code connectTimeoutMs}, {@code readTimeoutMs} and
{@link ErrorReporter}.
@param url target URL
@param connectTimeoutMs connection timeout in milliseconds.
@param readTimeoutMs read timeout in milliseconds.
@param errorReporter the error reporter. | sendMessage | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/GelfHTTPSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfHTTPSender.java | MIT |
@Override
public void close() {
// nothing to do
} | Create a new {@link GelfHTTPSender} given {@code url}, {@code connectTimeoutMs}, {@code readTimeoutMs} and
{@link ErrorReporter}.
@param url target URL
@param connectTimeoutMs connection timeout in milliseconds.
@param readTimeoutMs read timeout in milliseconds.
@param errorReporter the error reporter. | close | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/GelfHTTPSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfHTTPSender.java | MIT |
public boolean sendMessage(GelfMessage message) {
// prevent recursive self calls caused by the Redis driver since it
if (!callers.add(Thread.currentThread())) {
return false;
}
try {
return sendMessage0(message);
} finally {
callers.remove(T... | @author https://github.com/strima/logstash-gelf.git
@author Mark Paluch
@since 1.5 | sendMessage | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/GelfREDISSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfREDISSender.java | MIT |
protected boolean sendMessage0(GelfMessage message) {
try (Jedis jedisClient = jedisPool.getResource()) {
jedisClient.lpush(redisKey, message.toJson(""));
return true;
} catch (Exception e) {
errorReporter.reportError(e.getMessage(), new IOException("Cannot send REDIS... | @author https://github.com/strima/logstash-gelf.git
@author Mark Paluch
@since 1.5 | sendMessage0 | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/GelfREDISSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfREDISSender.java | MIT |
public void close() {
callers.clear();
jedisPool.destroy();
} | @author https://github.com/strima/logstash-gelf.git
@author Mark Paluch
@since 1.5 | close | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/GelfREDISSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfREDISSender.java | MIT |
@Override
protected ByteBuffer initialValue() {
return ByteBuffer.allocateDirect(INITIAL_BUFFER_SIZE);
} | @author https://github.com/t0xa/gelfj
@author Mark Paluch | initialValue | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/GelfTCPSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfTCPSender.java | MIT |
protected SocketChannel createSocketChannel(int readTimeoutMs, boolean keepAlive) throws IOException {
SocketChannel socketChannel = SocketChannel.open();
socketChannel.configureBlocking(false);
socketChannel.socket().setKeepAlive(keepAlive);
socketChannel.socket().setSoTimeout(readTimeo... | @param host the host, must not be {@literal null}.
@param port the port.
@param connectTimeoutMs connection timeout, in {@link TimeUnit#MILLISECONDS}.
@param readTimeoutMs read timeout, in {@link TimeUnit#MILLISECONDS}.
@param deliveryAttempts number of delivery attempts.
@param keepAlive {@literal true} to enable TCP ... | createSocketChannel | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/GelfTCPSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfTCPSender.java | MIT |
public boolean sendMessage(GelfMessage message) {
if (isShutdown()) {
return false;
}
IOException exception = null;
for (int i = 0; i < deliveryAttempts; i++) {
try {
// (re)-connect if necessary
if (!isConnected()) {
... | @param message the message
@return {@literal true} if message was sent. | sendMessage | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/GelfTCPSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfTCPSender.java | MIT |
protected void write(ByteBuffer buffer) throws IOException, InterruptedException {
int nothingWrittenTimesInRow = 0;
BackOffExecution backoffExecution = null;
while (buffer.hasRemaining()) {
int written = channel().write(buffer);
if (written < 0 || !isConnected()) {
... | @param message the message
@return {@literal true} if message was sent. | write | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/GelfTCPSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfTCPSender.java | MIT |
protected boolean connect() throws IOException {
if (isConnected()) {
return false;
}
Closer.close(channel());
setChannel(createSocketChannel(readTimeoutMs, keepAlive));
InetSocketAddress inetSocketAddress = new InetSocketAddress(getHost(), getPort());
if (... | @param message the message
@return {@literal true} if message was sent. | connect | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/GelfTCPSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfTCPSender.java | MIT |
@Override
protected boolean isConnected(SocketChannel channel) {
return channel.isConnected();
} | @param message the message
@return {@literal true} if message was sent. | isConnected | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/GelfTCPSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfTCPSender.java | MIT |
@Override
protected boolean connect() throws IOException {
if (super.connect()) {
this.sslEngine = sslContext.createSSLEngine();
this.sslEngine.setUseClientMode(true);
this.sslSession = sslEngine.getSession();
// Begin handshake
sslEngine.beginHan... | @param host the host, must not be {@literal null}.
@param port the port.
@param connectTimeoutMs connection timeout, in {@link TimeUnit#MILLISECONDS}.
@param readTimeoutMs read timeout, in {@link TimeUnit#MILLISECONDS}.
@param deliveryAttempts number of delivery attempts.
@param keepAlive {@literal true} to enable TCP ... | connect | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/GelfTCPSSLSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfTCPSSLSender.java | MIT |
@Override
protected boolean isConnected() throws IOException {
SocketChannel socketChannel = channel();
return socketChannel != null && socketChannel.isOpen() && isConnected(socketChannel);
} | @param host the host, must not be {@literal null}.
@param port the port.
@param connectTimeoutMs connection timeout, in {@link TimeUnit#MILLISECONDS}.
@param readTimeoutMs read timeout, in {@link TimeUnit#MILLISECONDS}.
@param deliveryAttempts number of delivery attempts.
@param keepAlive {@literal true} to enable TCP ... | isConnected | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/GelfTCPSSLSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfTCPSSLSender.java | MIT |
@Override
protected void write(ByteBuffer gelfBuffer) throws IOException {
while (gelfBuffer.hasRemaining()) {
read();
ByteBuffer myNetData = getNetworkBuffer();
// Generate SSL/TLS encoded data (handshake or application data)
gelfBuffer.mark();
... | @param host the host, must not be {@literal null}.
@param port the port.
@param connectTimeoutMs connection timeout, in {@link TimeUnit#MILLISECONDS}.
@param readTimeoutMs read timeout, in {@link TimeUnit#MILLISECONDS}.
@param deliveryAttempts number of delivery attempts.
@param keepAlive {@literal true} to enable TCP ... | write | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/GelfTCPSSLSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfTCPSSLSender.java | MIT |
private void read() throws IOException {
ByteBuffer myNetData = getNetworkBuffer();
ByteBuffer tempBuffer = getTempBuffer();
if (channel().read(myNetData) < 0) {
throw new SocketException("Channel closed");
}
// Process incoming handshaking data
myNetData.f... | @param host the host, must not be {@literal null}.
@param port the port.
@param connectTimeoutMs connection timeout, in {@link TimeUnit#MILLISECONDS}.
@param readTimeoutMs read timeout, in {@link TimeUnit#MILLISECONDS}.
@param deliveryAttempts number of delivery attempts.
@param keepAlive {@literal true} to enable TCP ... | read | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/GelfTCPSSLSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfTCPSSLSender.java | MIT |
private ByteBuffer getNetworkBuffer() {
ByteBuffer networkBuffer = this.sslNetworkBuffers.get();
if (networkBuffer == null) {
networkBuffer = ByteBuffer.allocateDirect(sslSession.getPacketBufferSize());
this.sslNetworkBuffers.set(networkBuffer);
}
networkBuffer.c... | @param host the host, must not be {@literal null}.
@param port the port.
@param connectTimeoutMs connection timeout, in {@link TimeUnit#MILLISECONDS}.
@param readTimeoutMs read timeout, in {@link TimeUnit#MILLISECONDS}.
@param deliveryAttempts number of delivery attempts.
@param keepAlive {@literal true} to enable TCP ... | getNetworkBuffer | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/GelfTCPSSLSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfTCPSSLSender.java | MIT |
private ByteBuffer getTempBuffer() {
ByteBuffer tempBuffer = this.tempBuffers.get();
if (tempBuffer == null) {
tempBuffer = ByteBuffer.allocateDirect(sslSession.getApplicationBufferSize());
this.tempBuffers.set(tempBuffer);
}
tempBuffer.clear();
return te... | @param host the host, must not be {@literal null}.
@param port the port.
@param connectTimeoutMs connection timeout, in {@link TimeUnit#MILLISECONDS}.
@param readTimeoutMs read timeout, in {@link TimeUnit#MILLISECONDS}.
@param deliveryAttempts number of delivery attempts.
@param keepAlive {@literal true} to enable TCP ... | getTempBuffer | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/GelfTCPSSLSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfTCPSSLSender.java | MIT |
private ByteBuffer enlargeBuffer(ByteBuffer src, ByteBuffer dst) {
// Could attempt to drain the dst buffer of any already obtained
// data, but we'll just increase it to the size needed.
ByteBuffer buffer = ByteBuffer.allocate(dst.capacity() + src.remaining());
dst.flip();
buff... | @param host the host, must not be {@literal null}.
@param port the port.
@param connectTimeoutMs connection timeout, in {@link TimeUnit#MILLISECONDS}.
@param readTimeoutMs read timeout, in {@link TimeUnit#MILLISECONDS}.
@param deliveryAttempts number of delivery attempts.
@param keepAlive {@literal true} to enable TCP ... | enlargeBuffer | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/GelfTCPSSLSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfTCPSSLSender.java | MIT |
private void doHandshake(SocketChannel socketChannel, SSLEngine sslEngine, ByteBuffer myNetData, ByteBuffer peerNetData)
throws IOException {
// Create byte buffers to use for holding application data
int appBufferSize = sslEngine.getSession().getApplicationBufferSize();
ByteBuffer ... | @param host the host, must not be {@literal null}.
@param port the port.
@param connectTimeoutMs connection timeout, in {@link TimeUnit#MILLISECONDS}.
@param readTimeoutMs read timeout, in {@link TimeUnit#MILLISECONDS}.
@param deliveryAttempts number of delivery attempts.
@param keepAlive {@literal true} to enable TCP ... | doHandshake | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/GelfTCPSSLSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfTCPSSLSender.java | MIT |
@Override
public void close() {
if (channel() != null) {
try {
closeSocketChannel();
} catch (IOException e) {
reportError(e.getMessage(), e);
}
}
super.close();
} | @param host the host, must not be {@literal null}.
@param port the port.
@param connectTimeoutMs connection timeout, in {@link TimeUnit#MILLISECONDS}.
@param readTimeoutMs read timeout, in {@link TimeUnit#MILLISECONDS}.
@param deliveryAttempts number of delivery attempts.
@param keepAlive {@literal true} to enable TCP ... | close | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/GelfTCPSSLSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfTCPSSLSender.java | MIT |
@Override
protected boolean isConnected(SocketChannel channel) {
return super.isConnected(channel) && channel.isOpen();
} | @param host the host, must not be {@literal null}.
@param port the port.
@param connectTimeoutMs connection timeout, in {@link TimeUnit#MILLISECONDS}.
@param readTimeoutMs read timeout, in {@link TimeUnit#MILLISECONDS}.
@param deliveryAttempts number of delivery attempts.
@param keepAlive {@literal true} to enable TCP ... | isConnected | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/GelfTCPSSLSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfTCPSSLSender.java | MIT |
private void closeSocketChannel() throws IOException {
if (sslEngine != null) {
sslEngine.closeOutbound();
if (sslSession != null) {
doHandshake(channel(), sslEngine, ByteBuffer.allocate(sslSession.getPacketBufferSize()),
ByteBuffer.allocate(ssl... | @param host the host, must not be {@literal null}.
@param port the port.
@param connectTimeoutMs connection timeout, in {@link TimeUnit#MILLISECONDS}.
@param readTimeoutMs read timeout, in {@link TimeUnit#MILLISECONDS}.
@param deliveryAttempts number of delivery attempts.
@param keepAlive {@literal true} to enable TCP ... | closeSocketChannel | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/GelfTCPSSLSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfTCPSSLSender.java | MIT |
@Override
protected ByteBuffer initialValue() {
return ByteBuffer.allocateDirect(INITIAL_BUFFER_SIZE);
} | @author https://github.com/t0xa/gelfj
@author Mark Paluch | initialValue | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/GelfUDPSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfUDPSender.java | MIT |
@Override
protected ByteBuffer initialValue() {
return ByteBuffer.allocateDirect(INITIAL_BUFFER_SIZE);
} | @author https://github.com/t0xa/gelfj
@author Mark Paluch | initialValue | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/GelfUDPSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfUDPSender.java | MIT |
public boolean sendMessage(GelfMessage message) {
if (INITIAL_BUFFER_SIZE == 0) {
return sendDatagrams(message.toUDPBuffers());
}
return sendDatagrams(GelfBuffers.toUDPBuffers(message, writeBuffers, tempBuffers));
} | @author https://github.com/t0xa/gelfj
@author Mark Paluch | sendMessage | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/GelfUDPSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfUDPSender.java | MIT |
private boolean sendDatagrams(ByteBuffer[] bytesList) {
try {
// (re)-connect if necessary
if (!isConnected()) {
synchronized (ioLock) {
connect();
}
}
for (ByteBuffer buffer : bytesList) {
syn... | @author https://github.com/t0xa/gelfj
@author Mark Paluch | sendDatagrams | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/GelfUDPSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfUDPSender.java | MIT |
protected void connect() throws IOException {
if (isConnected()) {
return;
}
if (channel() == null) {
setChannel(DatagramChannel.open());
} else if (!channel().isOpen()) {
Closer.close(channel());
setChannel(DatagramChannel.open());
... | @author https://github.com/t0xa/gelfj
@author Mark Paluch | connect | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/GelfUDPSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfUDPSender.java | MIT |
@Override
protected boolean isConnected(DatagramChannel channel) {
return channel.isConnected();
} | @author https://github.com/t0xa/gelfj
@author Mark Paluch | isConnected | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/GelfUDPSender.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfUDPSender.java | MIT |
static Map<String, String> parse(URI uri) {
Map<String, String> result = new HashMap<>();
String queryString = uri.getQuery();
if (queryString == null && uri.getSchemeSpecificPart() != null && uri.getSchemeSpecificPart().contains("?")) {
queryString = uri.getSchemeSpecificPart().su... | Parse the query part of an {@link URI} to a single-valued key-value map. All keys are transformed to lower-case.
@param uri
@return the key-value map. | parse | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/QueryStringParser.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/QueryStringParser.java | MIT |
static long getTimeAsMs(Map<String, String> map, String key, long defaultTimeMs) {
String value = map.get(key.toLowerCase());
if (value == null || value.trim().equals("")) {
return defaultTimeMs;
}
int numbersEnd = 0;
while (numbersEnd < value.length() && Character.... | Parse the query part of an {@link URI} to a single-valued key-value map. All keys are transformed to lower-case.
@param uri
@return the key-value map. | getTimeAsMs | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/QueryStringParser.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/QueryStringParser.java | MIT |
public static int getInt(Map<String, String> map, String key, int defaultValue) {
String value = map.get(key.toLowerCase());
if (value == null || value.trim().equals("")) {
return defaultValue;
}
return Integer.parseInt(value);
} | Parse the query part of an {@link URI} to a single-valued key-value map. All keys are transformed to lower-case.
@param uri
@return the key-value map. | getInt | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/QueryStringParser.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/QueryStringParser.java | MIT |
public static boolean getString(Map<String, String> map, String key, boolean defaultValue) {
String value = map.get(key.toLowerCase());
if (value == null || value.trim().equals("")) {
return defaultValue;
}
return "true".equalsIgnoreCase(value);
} | Parse the query part of an {@link URI} to a single-valued key-value map. All keys are transformed to lower-case.
@param uri
@return the key-value map. | getString | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/QueryStringParser.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/QueryStringParser.java | MIT |
public static String getHost(URI uri) {
String host = uri.getHost();
if (host == null) {
host = uri.getSchemeSpecificPart();
}
if (host.contains("?")) {
host = host.substring(0, host.indexOf('?'));
}
return host;
} | Parse the query part of an {@link URI} to a single-valued key-value map. All keys are transformed to lower-case.
@param uri
@return the key-value map. | getHost | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/QueryStringParser.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/QueryStringParser.java | MIT |
@Override
public boolean supports(String host) {
return host.startsWith(RedisSenderConstants.REDIS_SCHEME + ":")
|| host.startsWith(RedisSenderConstants.REDIS_SENTINEL_SCHEME + ":");
} | {@link GelfSenderProvider} to provide {@link GelfREDISSender}.
@author https://github.com/Batigoal/logstash-gelf.git
@since 1.4 | supports | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/RedisGelfSenderProvider.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/RedisGelfSenderProvider.java | MIT |
@Override
public GelfSender create(GelfSenderConfiguration configuration) throws IOException {
String graylogHost = configuration.getHost();
URI hostUri = URI.create(graylogHost);
int port = hostUri.getPort();
if (port <= 0) {
port = configuration.getPort();
}
... | {@link GelfSenderProvider} to provide {@link GelfREDISSender}.
@author https://github.com/Batigoal/logstash-gelf.git
@since 1.4 | create | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/RedisGelfSenderProvider.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/RedisGelfSenderProvider.java | MIT |
public static RedisPoolHolder getInstance() {
return INSTANCE;
} | Pool holder for {@link Pool} that keeps track of Jedis pools identified by {@link URI}.
This implementation synchronizes {@link #getJedisPool(URI, int)} and {@link Pool#destroy()} calls to avoid lingering
resources and acquisition of disposed resources. creation
@author Mark Paluch | getInstance | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | MIT |
public Pool<Jedis> getJedisPool(URI hostURI, int configuredPort) {
synchronized (mutex) {
String lowerCasedConnectionString = hostURI.toString().toLowerCase();
final String cleanConnectionString = hostURI.getFragment() != null ? lowerCasedConnectionString.substring(0,
... | Pool holder for {@link Pool} that keeps track of Jedis pools identified by {@link URI}.
This implementation synchronizes {@link #getJedisPool(URI, int)} and {@link Pool#destroy()} calls to avoid lingering
resources and acquisition of disposed resources. creation
@author Mark Paluch | getJedisPool | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | MIT |
@Override
public void run() {
standalonePools.remove(cleanConnectionString);
} | Pool holder for {@link Pool} that keeps track of Jedis pools identified by {@link URI}.
This implementation synchronizes {@link #getJedisPool(URI, int)} and {@link Pool#destroy()} calls to avoid lingering
resources and acquisition of disposed resources. creation
@author Mark Paluch | run | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | MIT |
@Override
public String getScheme() {
return RedisSenderConstants.REDIS_SCHEME;
} | Singleton for administration of commonly used jedis pools
@author https://github.com/Batigoal/logstash-gelf.git
@author Mark Paluch | getScheme | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | MIT |
@Override
public redis.clients.jedis.util.Pool<Jedis> createPool(URI hostURI, int configuredPort, int timeoutMs) {
String password = (hostURI.getUserInfo() != null) ? hostURI.getUserInfo().split(":", 2)[1] : null;
int database = Protocol.DEFAULT_DATABASE;
if ... | Create a Jedis Pool for standalone Redis Operations.
@param hostURI
@param configuredPort
@param timeoutMs
@return Pool of Jedis | createPool | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | MIT |
@Override
public String getScheme() {
return RedisSenderConstants.REDIS_SENTINEL_SCHEME;
} | Create a Jedis Pool for standalone Redis Operations.
@param hostURI
@param configuredPort
@param timeoutMs
@return Pool of Jedis | getScheme | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | MIT |
@Override
public redis.clients.jedis.util.Pool<Jedis> createPool(URI hostURI, int configuredPort, int timeoutMs) {
Set<String> sentinels = getSentinels(hostURI);
String masterName = getMasterName(hostURI);
// No logging for Jedis Sentinel at all.
... | Create a Jedis Pool for sentinel Redis Operations.
@param hostURI
@param configuredPort
@param timeoutMs
@return Pool of Jedis | createPool | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | MIT |
protected String getMasterName(URI hostURI) {
String masterName = "master";
if (hostURI.getQuery() != null) {
String[] keyValues = hostURI.getQuery().split("\\&");
for (String keyValue : keyValues) {
String[] parts = keyVal... | Create a Jedis Pool for sentinel Redis Operations.
@param hostURI
@param configuredPort
@param timeoutMs
@return Pool of Jedis | getMasterName | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | MIT |
protected Set<String> getSentinels(URI hostURI) {
Set<String> sentinels = new HashSet<>();
String[] sentinelHostNames = hostURI.getHost().split("\\,");
for (String sentinelHostName : sentinelHostNames) {
if (sentinelHostName.contains(":")) {
... | Create a Jedis Pool for sentinel Redis Operations.
@param hostURI
@param configuredPort
@param timeoutMs
@return Pool of Jedis | getSentinels | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | MIT |
public static redis.clients.jedis.util.Pool<Jedis> createJedisPool(URI hostURI, int configuredPort, int timeoutMs) {
for (JedisPoolFactory provider : JedisPoolFactory.values()) {
if (provider.getScheme().equals(hostURI.getScheme())) {
return provider.createPool(hostURI, ... | Create a Jedis Pool for sentinel Redis Operations.
@param hostURI
@param configuredPort
@param timeoutMs
@return Pool of Jedis | createJedisPool | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | MIT |
@Override
public void close() {
delegate.close();
} | Create a Jedis Pool for sentinel Redis Operations.
@param hostURI
@param configuredPort
@param timeoutMs
@return Pool of Jedis | close | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | MIT |
@Override
public boolean isClosed() {
return delegate.isClosed();
} | Create a Jedis Pool for sentinel Redis Operations.
@param hostURI
@param configuredPort
@param timeoutMs
@return Pool of Jedis | isClosed | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | MIT |
@Override
public void initPool(GenericObjectPoolConfig<Jedis> poolConfig, PooledObjectFactory<Jedis> factory) {
delegate.initPool(poolConfig, factory);
} | Create a Jedis Pool for sentinel Redis Operations.
@param hostURI
@param configuredPort
@param timeoutMs
@return Pool of Jedis | initPool | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | MIT |
@Override
public Jedis getResource() {
return delegate.getResource();
} | Create a Jedis Pool for sentinel Redis Operations.
@param hostURI
@param configuredPort
@param timeoutMs
@return Pool of Jedis | getResource | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | MIT |
@Override
public void returnResourceObject(Jedis resource) {
throw new UnsupportedOperationException();
} | Create a Jedis Pool for sentinel Redis Operations.
@param hostURI
@param configuredPort
@param timeoutMs
@return Pool of Jedis | returnResourceObject | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | MIT |
@Override
public void destroy() {
synchronized (mutex) {
long val = refCnt.decrementAndGet();
if (val == 0) {
onDestroy.run();
delegate.destroy();
}
}
} | Create a Jedis Pool for sentinel Redis Operations.
@param hostURI
@param configuredPort
@param timeoutMs
@return Pool of Jedis | destroy | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | MIT |
@Override
public int getNumActive() {
return delegate.getNumActive();
} | Create a Jedis Pool for sentinel Redis Operations.
@param hostURI
@param configuredPort
@param timeoutMs
@return Pool of Jedis | getNumActive | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | MIT |
@Override
public int getNumIdle() {
return delegate.getNumIdle();
} | Create a Jedis Pool for sentinel Redis Operations.
@param hostURI
@param configuredPort
@param timeoutMs
@return Pool of Jedis | getNumIdle | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | MIT |
@Override
public int getNumWaiters() {
return delegate.getNumWaiters();
} | Create a Jedis Pool for sentinel Redis Operations.
@param hostURI
@param configuredPort
@param timeoutMs
@return Pool of Jedis | getNumWaiters | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | MIT |
@Override
public long getMeanBorrowWaitTimeMillis() {
return delegate.getMeanBorrowWaitTimeMillis();
} | Create a Jedis Pool for sentinel Redis Operations.
@param hostURI
@param configuredPort
@param timeoutMs
@return Pool of Jedis | getMeanBorrowWaitTimeMillis | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | MIT |
@Override
public long getMaxBorrowWaitTimeMillis() {
return delegate.getMaxBorrowWaitTimeMillis();
} | Create a Jedis Pool for sentinel Redis Operations.
@param hostURI
@param configuredPort
@param timeoutMs
@return Pool of Jedis | getMaxBorrowWaitTimeMillis | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | MIT |
@Override
public void addObjects(int count) {
throw new UnsupportedOperationException();
} | Create a Jedis Pool for sentinel Redis Operations.
@param hostURI
@param configuredPort
@param timeoutMs
@return Pool of Jedis | addObjects | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/intern/sender/RedisPoolHolder.java | MIT |
public boolean isEnabled() {
return enabled;
} | Logging-Handler for GELF (Graylog Extended Logging Format). This Java-Util-Logging Handler creates GELF Messages and posts
them using UDP (default) or TCP. Following parameters are supported/needed:
<ul>
<li>host (Mandatory): Hostname/IP-Address of the Logstash Host
<ul>
<li>(the host) for UDP, e.g. 127.0.0.1 or some.h... | isEnabled | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/jboss7/JBoss7GelfLogHandler.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/jboss7/JBoss7GelfLogHandler.java | MIT |
public void setEnabled(boolean enabled) {
this.enabled = enabled;
} | Manually enable/disable the handler. This is also called by wildfly logger setup routines on server-startup with the
value of the "enabled" attribute of {@code <custom-handler>}.
@param enabled {@literal false} to disable this handler. | setEnabled | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/jboss7/JBoss7GelfLogHandler.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/jboss7/JBoss7GelfLogHandler.java | MIT |
@Override
protected void initializeDefaultFields() {
gelfMessageAssembler.addFields(LogMessageField.getDefaultMapping(Time, Severity, ThreadName, SourceClassName,
SourceMethodName, SourceSimpleClassName, LoggerName, NDC));
} | Manually enable/disable the handler. This is also called by wildfly logger setup routines on server-startup with the
value of the "enabled" attribute of {@code <custom-handler>}.
@param enabled {@literal false} to disable this handler. | initializeDefaultFields | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/jboss7/JBoss7GelfLogHandler.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/jboss7/JBoss7GelfLogHandler.java | MIT |
@Override
public boolean isLoggable(LogRecord record) {
return enabled && super.isLoggable(record);
} | Manually enable/disable the handler. This is also called by wildfly logger setup routines on server-startup with the
value of the "enabled" attribute of {@code <custom-handler>}.
@param enabled {@literal false} to disable this handler. | isLoggable | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/jboss7/JBoss7GelfLogHandler.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/jboss7/JBoss7GelfLogHandler.java | MIT |
@Override
public void publish(LogRecord record) {
super.publish(ExtLogRecord.wrap(record));
} | Manually enable/disable the handler. This is also called by wildfly logger setup routines on server-startup with the
value of the "enabled" attribute of {@code <custom-handler>}.
@param enabled {@literal false} to disable this handler. | publish | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/jboss7/JBoss7GelfLogHandler.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/jboss7/JBoss7GelfLogHandler.java | MIT |
@Override
protected GelfMessageAssembler createGelfMessageAssembler() {
return new MdcGelfMessageAssembler();
} | Manually enable/disable the handler. This is also called by wildfly logger setup routines on server-startup with the
value of the "enabled" attribute of {@code <custom-handler>}.
@param enabled {@literal false} to disable this handler. | createGelfMessageAssembler | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/jboss7/JBoss7GelfLogHandler.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/jboss7/JBoss7GelfLogHandler.java | MIT |
@Override
protected GelfMessage createGelfMessage(final LogRecord record) {
return getGelfMessageAssembler().createGelfMessage(new JBoss7JulLogEvent((ExtLogRecord) record));
} | Manually enable/disable the handler. This is also called by wildfly logger setup routines on server-startup with the
value of the "enabled" attribute of {@code <custom-handler>}.
@param enabled {@literal false} to disable this handler. | createGelfMessage | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/jboss7/JBoss7GelfLogHandler.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/jboss7/JBoss7GelfLogHandler.java | MIT |
public boolean isMdcProfiling() {
return getGelfMessageAssembler().isMdcProfiling();
} | Manually enable/disable the handler. This is also called by wildfly logger setup routines on server-startup with the
value of the "enabled" attribute of {@code <custom-handler>}.
@param enabled {@literal false} to disable this handler. | isMdcProfiling | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/jboss7/JBoss7GelfLogHandler.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/jboss7/JBoss7GelfLogHandler.java | MIT |
public boolean isIncludeFullMdc() {
return getGelfMessageAssembler().isIncludeFullMdc();
} | Manually enable/disable the handler. This is also called by wildfly logger setup routines on server-startup with the
value of the "enabled" attribute of {@code <custom-handler>}.
@param enabled {@literal false} to disable this handler. | isIncludeFullMdc | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/jboss7/JBoss7GelfLogHandler.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/jboss7/JBoss7GelfLogHandler.java | MIT |
private MdcGelfMessageAssembler getGelfMessageAssembler() {
return (MdcGelfMessageAssembler) gelfMessageAssembler;
} | Manually enable/disable the handler. This is also called by wildfly logger setup routines on server-startup with the
value of the "enabled" attribute of {@code <custom-handler>}.
@param enabled {@literal false} to disable this handler. | getGelfMessageAssembler | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/jboss7/JBoss7GelfLogHandler.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/jboss7/JBoss7GelfLogHandler.java | MIT |
private void configure() {
String cname = getClass().getName();
LogManager manager = LogManager.getLogManager();
String val = manager.getProperty(cname + ".fields");
if (val != null) {
setFields(val);
}
val = manager.getProperty(cname + ".version");
... | Log-Formatter for JSON using fields specified within GELF. This formatter will produce a JSON object for each log event.
Example:
<code>
{
"timestamp": "1439319236.722",
"SourceClassName": "biz.paluch.logging.gelf.wildfly.WildFlyGelfLogFormatterTest",
"SourceMethodName": "testDefaults",
"level": "6",
... | configure | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/jul/GelfFormatter.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/jul/GelfFormatter.java | MIT |
@Override
public String format(final LogRecord record) {
if (!wasSetFieldsCalled) {
addFields(SUPPORTED_FIELDS);
}
GelfMessage gelfMessage = gelfMessageAssembler.createGelfMessage(new JulLogEvent(record));
return gelfMessage.toJson("") + lineBreak;
} | Log-Formatter for JSON using fields specified within GELF. This formatter will produce a JSON object for each log event.
Example:
<code>
{
"timestamp": "1439319236.722",
"SourceClassName": "biz.paluch.logging.gelf.wildfly.WildFlyGelfLogFormatterTest",
"SourceMethodName": "testDefaults",
"level": "6",
... | format | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/jul/GelfFormatter.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/jul/GelfFormatter.java | MIT |
public void setFields(String fieldSpec) {
String[] properties = fieldSpec.split(MULTI_VALUE_DELIMITTER);
List<LogMessageField.NamedLogField> fields = new ArrayList<>();
for (String field : properties) {
LogMessageField.NamedLogField namedLogField = LogMessageField.NamedLogField.byN... | Log-Formatter for JSON using fields specified within GELF. This formatter will produce a JSON object for each log event.
Example:
<code>
{
"timestamp": "1439319236.722",
"SourceClassName": "biz.paluch.logging.gelf.wildfly.WildFlyGelfLogFormatterTest",
"SourceMethodName": "testDefaults",
"level": "6",
... | setFields | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/jul/GelfFormatter.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/jul/GelfFormatter.java | MIT |
private void addFields(Collection<LogMessageField.NamedLogField> fields) {
gelfMessageAssembler.addFields(LogMessageField.getDefaultMapping(fields
.toArray(new LogMessageField.NamedLogField[fields.size()])));
wasSetFieldsCalled = true;
} | Log-Formatter for JSON using fields specified within GELF. This formatter will produce a JSON object for each log event.
Example:
<code>
{
"timestamp": "1439319236.722",
"SourceClassName": "biz.paluch.logging.gelf.wildfly.WildFlyGelfLogFormatterTest",
"SourceMethodName": "testDefaults",
"level": "6",
... | addFields | java | mp911de/logstash-gelf | src/main/java/biz/paluch/logging/gelf/jul/GelfFormatter.java | https://github.com/mp911de/logstash-gelf/blob/master/src/main/java/biz/paluch/logging/gelf/jul/GelfFormatter.java | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.