We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No description provided.
The text was updated successfully, but these errors were encountered:
EventLoopsScheduler.java
static final FixedSchedulerPool NONE = new FixedSchedulerPool(null, 0); static final class FixedSchedulerPool { final int cores; final PoolWorker[] eventLoops; long n; FixedSchedulerPool(ThreadFactory threadFactory, int maxThreads) { // initialize event loops this.cores = maxThreads; this.eventLoops = new PoolWorker[maxThreads]; // 这里新建了一个线程组 for (int i = 0; i < maxThreads; i++) { // new出每个线程 this.eventLoops[i] = new PoolWorker(threadFactory); } } public PoolWorker getEventLoop() { int c = cores; if (c == 0) { return SHUTDOWN_WORKER; } // simple round robin, improvements to come return eventLoops[(int)(n++ % c)]; } public void shutdown() { for (PoolWorker w : eventLoops) { w.unsubscribe(); } } } static final class PoolWorker extends NewThreadWorker { PoolWorker(ThreadFactory threadFactory) { super(threadFactory); } }
NewThreadWorker.java
public NewThreadWorker(ThreadFactory threadFactory) { ScheduledExecutorService exec = Executors.newScheduledThreadPool(1, threadFactory); // Java 7+: cancelled future tasks can be removed from the executor thus avoiding memory leak boolean cancelSupported = tryEnableCancelPolicy(exec); if (!cancelSupported && exec instanceof ScheduledThreadPoolExecutor) { registerExecutor((ScheduledThreadPoolExecutor)exec); } executor = exec; }
Sorry, something went wrong.
zengjingfang
No branches or pull requests
No description provided.
The text was updated successfully, but these errors were encountered: