Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
named, daemonised and applied fix as suggested in #36
some unknown 'ForkJoinPool.commonPool-worker-' remaining
- Loading branch information
1 parent
46a7776
commit e8aa9ff
Showing
6 changed files
with
76 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
chartfx-dataset/src/main/java/de/gsi/dataset/utils/CachedDaemonThreadFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package de.gsi.dataset.utils; | ||
|
||
import java.util.concurrent.Executors; | ||
import java.util.concurrent.ThreadFactory; | ||
|
||
public class CachedDaemonThreadFactory implements ThreadFactory { | ||
private static final ThreadFactory defaultFactory = Executors.defaultThreadFactory(); | ||
private static final CachedDaemonThreadFactory SELF = new CachedDaemonThreadFactory(); | ||
private static int threadCounter = 1; | ||
|
||
private CachedDaemonThreadFactory() { | ||
// helper class | ||
} | ||
|
||
public static CachedDaemonThreadFactory getInstance() { | ||
return SELF; | ||
} | ||
|
||
@Override | ||
public Thread newThread(Runnable r) { | ||
Thread thread = defaultFactory.newThread(r); | ||
thread.setName("daemonised_chartfx_thread_#" + threadCounter); | ||
threadCounter++; | ||
thread.setDaemon(true); | ||
return thread; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters