File tree Expand file tree Collapse file tree 1 file changed +7
-13
lines changed
SwiftKitCore/src/main/java/org/swift/swiftkit/core Expand file tree Collapse file tree 1 file changed +7
-13
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 .ForkJoinPool ;
1920import java .util .concurrent .ThreadFactory ;
2021import java .util .concurrent .atomic .AtomicInteger ;
2122
2223public final class SwiftAsync {
2324
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 );
25+ public static final ExecutorService SWIFT_ASYNC_EXECUTOR = new ForkJoinPool (
26+ Runtime .getRuntime ().availableProcessors (),
27+ ForkJoinPool .defaultForkJoinWorkerThreadFactory ,
28+ null ,
29+ true
30+ );
3731}
You can’t perform that action at this time.
0 commit comments