Skip to content

Commit

Permalink
v3.4.5
Browse files Browse the repository at this point in the history
  • Loading branch information
fractalwrench authored Apr 4, 2019
2 parents 1df3a3a + 563d1d5 commit 777edf4
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 10 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Changelog

## 3.X.X (TBD)
## 3.4.5 (2019-04-04)

* Migrate non-standard device fields to metaData.device
[#131](https://github.com/bugsnag/bugsnag-java/pull/131)

* Set thread name to aid debugging
[#138](https://github.com/bugsnag/bugsnag-java/pull/138)

* Merge internal checkstyle rules
[#137](https://github.com/bugsnag/bugsnag-java/pull/137)
Expand Down
13 changes: 12 additions & 1 deletion bugsnag/src/main/java/com/bugsnag/Bugsnag.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
import java.util.Date;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

Expand All @@ -26,12 +28,21 @@ public class Bugsnag {
private static final int SESSION_TRACKING_PERIOD_MS = 60000;
private static final int CORE_POOL_SIZE = 1;

private final ThreadFactory sessionThreadFactory = new ThreadFactory() {
@Override
public Thread newThread(Runnable runnable) {
Thread thread = Executors.defaultThreadFactory().newThread(runnable);
thread.setName("bugsnag-sessions-" + thread.getId());
return thread;
}
};
// Create an executor service which keeps idle threads alive for a maximum of SHUTDOWN_TIMEOUT.
// This should avoid blocking an application that doesn't call shutdown from exiting.
private ExecutorService sessionFlusherService =
new ThreadPoolExecutor(0, 1,
SHUTDOWN_TIMEOUT_MS, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>());
new LinkedBlockingQueue<Runnable>(),
sessionThreadFactory);

private ScheduledThreadPoolExecutor sessionExecutorService =
new ScheduledThreadPoolExecutor(CORE_POOL_SIZE,
Expand Down
2 changes: 1 addition & 1 deletion bugsnag/src/main/java/com/bugsnag/Notifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class Notifier {

private static final String NOTIFIER_NAME = "Bugsnag Java";
private static final String NOTIFIER_VERSION = "3.4.4";
private static final String NOTIFIER_VERSION = "3.4.5";
private static final String NOTIFIER_URL = "https://github.com/bugsnag/bugsnag-java";

private String notifierName = NOTIFIER_NAME;
Expand Down
4 changes: 4 additions & 0 deletions bugsnag/src/main/java/com/bugsnag/Report.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,9 @@ public Report clearTab(String tabName) {
* @param key the key of app info to add
* @param value the value of app info to add
* @return the modified report
* @deprecated use {@link #addToTab(String, String, Object)} instead
*/
@Deprecated
public Report setAppInfo(String key, Object value) {
diagnostics.app.put(key, value);
return this;
Expand Down Expand Up @@ -252,7 +254,9 @@ public Report setContext(String context) {
* @param key the key of device info to add
* @param value the value of device info to add
* @return the modified report
* @deprecated use {@link #addToTab(String, String, Object)} instead
*/
@Deprecated
public Report setDeviceInfo(String key, Object value) {
diagnostics.device.put(key, value);
return this;
Expand Down
10 changes: 5 additions & 5 deletions bugsnag/src/main/java/com/bugsnag/callbacks/DeviceCallback.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ public static void initializeCache() {
@Override
public void beforeNotify(Report report) {
report
.addToTab("device", "osArch", System.getProperty("os.arch"))
.addToTab("device", "runtimeName", System.getProperty("java.runtime.name"))
.addToTab("device", "runtimeVersion", System.getProperty("java.runtime.version"))
.addToTab("device", "locale", Locale.getDefault())
.setDeviceInfo("hostname", getHostnameValue())
.setDeviceInfo("osName", System.getProperty("os.name"))
.setDeviceInfo("osVersion", System.getProperty("os.version"))
.setDeviceInfo("osArch", System.getProperty("os.arch"))
.setDeviceInfo("runtimeName", System.getProperty("java.runtime.name"))
.setDeviceInfo("runtimeVersion", System.getProperty("java.runtime.version"))
.setDeviceInfo("locale", Locale.getDefault());
.setDeviceInfo("osVersion", System.getProperty("os.version"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
import java.net.Proxy;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

Expand All @@ -18,12 +20,21 @@ public class AsyncHttpDelivery implements HttpDelivery {

private HttpDelivery baseDelivery;

private final ThreadFactory threadFactory = new ThreadFactory() {
@Override
public Thread newThread(Runnable runnable) {
Thread thread = Executors.defaultThreadFactory().newThread(runnable);
thread.setName("bugsnag-async-delivery-" + thread.getId());
return thread;
}
};
// Create an exector service which keeps idle threads alive for a maximum of SHUTDOWN_TIMEOUT.
// This should avoid blocking an application that doesn't call shutdown from exiting.
private ExecutorService executorService =
new ThreadPoolExecutor(0, 1,
SHUTDOWN_TIMEOUT, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>());
new LinkedBlockingQueue<Runnable>(),
threadFactory);

private boolean shuttingDown = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public DaemonThreadFactory() {
@Override
public Thread newThread(Runnable runner) {
Thread daemonThread = defaultThreadFactory.newThread(runner);
daemonThread.setName("bugsnag-daemon-" + daemonThread.getId());

// Set the threads to daemon to allow the app to shutdown properly
if (!daemonThread.isDaemon()) {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=3.4.4
version=3.4.5
group=com.bugsnag

# Default properties
Expand Down

0 comments on commit 777edf4

Please sign in to comment.