File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
SwiftKitCore/src/main/java/org/swift/swiftkit/core Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 1616
1717import java .util .concurrent .ExecutorService ;
1818import java .util .concurrent .Executors ;
19+ import java .util .concurrent .ThreadFactory ;
20+ import java .util .concurrent .atomic .AtomicInteger ;
1921
2022public final class SwiftAsync {
21- public static final ExecutorService SWIFT_ASYNC_EXECUTOR = Executors .newCachedThreadPool ();
23+
24+ private static final ThreadFactory SWIFT_ASYNC_THREAD_FACTORY = new ThreadFactory () {
25+ private final AtomicInteger threadNumber = new AtomicInteger (1 );
26+ private final String namePrefix = "swift-async-pool-" ;
27+
28+ @ Override
29+ public Thread newThread (Runnable r ) {
30+ Thread t = new Thread (r , namePrefix + threadNumber .getAndIncrement ());
31+ t .setDaemon (true );
32+ return t ;
33+ }
34+ };
35+
36+ public static final ExecutorService SWIFT_ASYNC_EXECUTOR = Executors .newCachedThreadPool (SWIFT_ASYNC_THREAD_FACTORY );
2237}
You can’t perform that action at this time.
0 commit comments