Skip to content

Commit

Permalink
Release 1.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Shakeel Mohamed committed Oct 24, 2018
2 parents 116d430 + 4463fe9 commit 5279f6d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 20 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,9 @@
# Splunk Logging for Java Changelog

## Version 1.6.1

* TcpAppender performance improvement, prevents 100% CPU usage [#85](https://github.com/splunk/splunk-library-javalogging/pull/85).

## Version 1.6.0
* Changed messagedMimeType metadata property to messageFormat
* Fixes unit tests, and performance issues
Expand Down
2 changes: 1 addition & 1 deletion README.md
@@ -1,6 +1,6 @@
# Splunk Logging for Java

#### Version 1.6.0
#### Version 1.6.1

This project provides utilities to easily log data using Splunk's recommended
best practices to any supported logger, using any of the three major Java
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -6,7 +6,7 @@

<groupId>com.splunk.logging</groupId>
<artifactId>splunk-library-javalogging</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
<packaging>jar</packaging>

<name>Splunk Logging for Java</name>
Expand Down
28 changes: 10 additions & 18 deletions src/main/java/com/splunk/logging/TcpAppender.java
Expand Up @@ -129,23 +129,7 @@ public void run() {
} catch (InterruptedException ex) {
// Exiting.
}
addInfo("shutting down");

// The thread pool used by the default executor spawns non-daemon
// threads that prevent appropriate termination of the program.
//
// To ensure that the program eventually terminates, we reconfigure the
// shared executor service to spin down to zero worker threads when no
// work is left.
//
// Can't do this work in the constructor because the context isn't yet set.
//
// It is possible for someone else to replace the executor, so only
// perform this special logic if it looks like we still have the default executor.
ExecutorService service = this.getContext().getExecutorService();
if (service instanceof ThreadPoolExecutor) {
((ThreadPoolExecutor) service).setCorePoolSize(0);
}
addInfo("exiting");
}

private SocketConnector initSocketConnector() {
Expand Down Expand Up @@ -252,7 +236,15 @@ public void start() {
// Dispatch this instance of the appender.
if (!errorPresent) {
queue = queueSize <= 0 ? new SynchronousQueue<ILoggingEvent>() : new ArrayBlockingQueue<ILoggingEvent>(queueSize);
executor = Executors.newSingleThreadExecutor();
ThreadFactory factory = new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
Thread t = new Thread(r, "splunk-tcp-appender");
t.setDaemon(true);
return t;
}
};
executor = Executors.newSingleThreadExecutor(factory);
executor.execute(this);
}

Expand Down

0 comments on commit 5279f6d

Please sign in to comment.