閱讀169 返回首頁    go iPhone_iPad_Mac_apple


線程池的實現原理

 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