Permalink
Browse files

Wait to ask to collect anonymous statistics in JabRefExecutorService …

…to allow jvm to terminate (#3266)

* use JabRefExecutorService for TrackingNotification instead of a new ExecutorService

* add changelog entry
  • Loading branch information...
1 parent effe334 commit 7ef2b3a01687648d7cdeca1498551426117bdf84 @125m125 125m125 committed with tobiasdiez Oct 6, 2017
Showing with 10 additions and 5 deletions.
  1. +1 −0 CHANGELOG.md
  2. +9 −5 src/main/java/org/jabref/gui/JabRefFrame.java
View
@@ -16,6 +16,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We added support for '[entrytype]' bracketed expression.
### Fixed
+ - We fixed an issue where JabRef would not terminated after asking to collect anonymous statistics [#2955 comment](https://github.com/JabRef/jabref/issues/2955#issuecomment-334591123)
### Removed
@@ -30,9 +30,7 @@
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
+import java.util.TimerTask;
import javax.swing.AbstractAction;
import javax.swing.Action;
@@ -64,6 +62,7 @@
import javafx.application.Platform;
import org.jabref.Globals;
+import org.jabref.JabRefExecutorService;
import org.jabref.gui.actions.Actions;
import org.jabref.gui.actions.AutoLinkFilesAction;
import org.jabref.gui.actions.ConnectToSharedDatabaseAction;
@@ -661,8 +660,13 @@ public void windowClosing(WindowEvent e) {
private void initShowTrackingNotification() {
if (!Globals.prefs.shouldAskToCollectTelemetry()) {
- ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor();
- scheduler.schedule(() -> DefaultTaskExecutor.runInJavaFXThread(this::showTrackingNotification), 1, TimeUnit.MINUTES);
+ JabRefExecutorService.INSTANCE.submit(new TimerTask() {
+
+ @Override
+ public void run() {
+ DefaultTaskExecutor.runInJavaFXThread(JabRefFrame.this::showTrackingNotification);
+ }
+ }, 60000); // run in one minute
}
}

0 comments on commit 7ef2b3a

Please sign in to comment.