Skip to content

Commit 777edf4

Browse files
v3.4.5
2 parents 1df3a3a + 563d1d5 commit 777edf4

8 files changed

Lines changed: 43 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Changelog
22

3-
## 3.X.X (TBD)
3+
## 3.4.5 (2019-04-04)
4+
5+
* Migrate non-standard device fields to metaData.device
6+
[#131](https://github.com/bugsnag/bugsnag-java/pull/131)
7+
8+
* Set thread name to aid debugging
9+
[#138](https://github.com/bugsnag/bugsnag-java/pull/138)
410

511
* Merge internal checkstyle rules
612
[#137](https://github.com/bugsnag/bugsnag-java/pull/137)

bugsnag/src/main/java/com/bugsnag/Bugsnag.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414
import java.util.Date;
1515
import java.util.Set;
1616
import java.util.concurrent.ExecutorService;
17+
import java.util.concurrent.Executors;
1718
import java.util.concurrent.LinkedBlockingQueue;
1819
import java.util.concurrent.RejectedExecutionHandler;
1920
import java.util.concurrent.ScheduledThreadPoolExecutor;
21+
import java.util.concurrent.ThreadFactory;
2022
import java.util.concurrent.ThreadPoolExecutor;
2123
import java.util.concurrent.TimeUnit;
2224

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

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

3647
private ScheduledThreadPoolExecutor sessionExecutorService =
3748
new ScheduledThreadPoolExecutor(CORE_POOL_SIZE,

bugsnag/src/main/java/com/bugsnag/Notifier.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
class Notifier {
66

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

1111
private String notifierName = NOTIFIER_NAME;

bugsnag/src/main/java/com/bugsnag/Report.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,9 @@ public Report clearTab(String tabName) {
209209
* @param key the key of app info to add
210210
* @param value the value of app info to add
211211
* @return the modified report
212+
* @deprecated use {@link #addToTab(String, String, Object)} instead
212213
*/
214+
@Deprecated
213215
public Report setAppInfo(String key, Object value) {
214216
diagnostics.app.put(key, value);
215217
return this;
@@ -252,7 +254,9 @@ public Report setContext(String context) {
252254
* @param key the key of device info to add
253255
* @param value the value of device info to add
254256
* @return the modified report
257+
* @deprecated use {@link #addToTab(String, String, Object)} instead
255258
*/
259+
@Deprecated
256260
public Report setDeviceInfo(String key, Object value) {
257261
diagnostics.device.put(key, value);
258262
return this;

bugsnag/src/main/java/com/bugsnag/callbacks/DeviceCallback.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ public static void initializeCache() {
5555
@Override
5656
public void beforeNotify(Report report) {
5757
report
58+
.addToTab("device", "osArch", System.getProperty("os.arch"))
59+
.addToTab("device", "runtimeName", System.getProperty("java.runtime.name"))
60+
.addToTab("device", "runtimeVersion", System.getProperty("java.runtime.version"))
61+
.addToTab("device", "locale", Locale.getDefault())
5862
.setDeviceInfo("hostname", getHostnameValue())
5963
.setDeviceInfo("osName", System.getProperty("os.name"))
60-
.setDeviceInfo("osVersion", System.getProperty("os.version"))
61-
.setDeviceInfo("osArch", System.getProperty("os.arch"))
62-
.setDeviceInfo("runtimeName", System.getProperty("java.runtime.name"))
63-
.setDeviceInfo("runtimeVersion", System.getProperty("java.runtime.version"))
64-
.setDeviceInfo("locale", Locale.getDefault());
64+
.setDeviceInfo("osVersion", System.getProperty("os.version"));
6565
}
6666
}

bugsnag/src/main/java/com/bugsnag/delivery/AsyncHttpDelivery.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
import java.net.Proxy;
99
import java.util.Map;
1010
import java.util.concurrent.ExecutorService;
11+
import java.util.concurrent.Executors;
1112
import java.util.concurrent.LinkedBlockingQueue;
13+
import java.util.concurrent.ThreadFactory;
1214
import java.util.concurrent.ThreadPoolExecutor;
1315
import java.util.concurrent.TimeUnit;
1416

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

1921
private HttpDelivery baseDelivery;
2022

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

2839
private boolean shuttingDown = false;
2940

bugsnag/src/main/java/com/bugsnag/util/DaemonThreadFactory.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public DaemonThreadFactory() {
2121
@Override
2222
public Thread newThread(Runnable runner) {
2323
Thread daemonThread = defaultThreadFactory.newThread(runner);
24+
daemonThread.setName("bugsnag-daemon-" + daemonThread.getId());
2425

2526
// Set the threads to daemon to allow the app to shutdown properly
2627
if (!daemonThread.isDaemon()) {

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version=3.4.4
1+
version=3.4.5
22
group=com.bugsnag
33

44
# Default properties

0 commit comments

Comments
 (0)