阅读169 返回首页    go 阿里云 go 技术社区[云栖]


线程池的实现原理

 public ThreadPoolExecutor(int corePoolSize,  int maximumPoolSize,long keepAliveTime,TimeUnit unit, BlockingQueue<Runnable> workQueue,
                              ThreadFactory threadFactory,  RejectedExecutionHandler handler) {

        if (corePoolSize < 0 ||  maximumPoolSize <= 0 ||  maximumPoolSize < corePoolSize || keepAliveTime < 0)
            throw new IllegalArgumentException();
        if (workQueue == null || threadFactory == null || handler == null)
            throw new NullPointerException();

        this.corePoolSize = corePoolSize;
        this.maximumPoolSize = maximumPoolSize;
        this.workQueue = workQueue;
        this.keepAliveTime = unit.toNanos(keepAliveTime);
        this.threadFactory = threadFactory;
        this.handler = handler;
    }

最后更新:2017-09-02 01:33:09

  上一篇:go  【CDN 最佳实践】CDN缓存策略解读和配置策略
  下一篇:go  Waiting for Slave Worker to release partition