zoukankan      html  css  js  c++  java
  • 线程池创建

        static final int poolSize = 50;
        static final long keepAliveTime = 0L;
        static final ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat("Thread-pool-MlanguageNavigationAspect-%d").setDaemon(true).build();
        static final ExecutorService executorService = new ThreadPoolExecutor(
                poolSize,
                poolSize,
                keepAliveTime,
                TimeUnit.MILLISECONDS,
                //无界队列 LinkedBlockingQueue
                //有界队列 ArrayBlockingQueue PriorityBlockingQueue
                //同步移交 SynchronousQueue
                new LinkedBlockingQueue<Runnable>(),
                threadFactory,
                //AbortPolicy中止策略
                //DiscardPolicy抛弃策略
                //DiscardOldestPolicy抛弃旧任务策略
                //CallerRunsPolicy调用者运行
                new ThreadPoolExecutor.AbortPolicy());
    ScheduledExecutorService diagnosesExecutorService = new ScheduledThreadPoolExecutor(200, new BasicThreadFactory.Builder().namingPattern("DiagnosesFacade-diagnosesExecutorService-%d").daemon(true).build());
    ExecutorService pool = new ThreadPoolExecutor(5, 200, 0L, TimeUnit.MILLISECONDS,
                new LinkedBlockingQueue<>(1024),
                new ThreadFactoryBuilder().setNameFormat("DiagnosesFacade-diagnosesExecutorService-%d").build(),
                new ThreadPoolExecutor.AbortPolicy());
  • 相关阅读:
    MYSQL转MSSQL
    SVN 服务器IP地址变更后客户端的修改
    gridview
    gridview外边距
    Android开发:自定义GridView/ListView数据源
    Android之Adapter用法总结
    collection set
    listview优化
    android应用开发全程实录-你有多熟悉listview
    android模块
  • 原文地址:https://www.cnblogs.com/wanhua-wu/p/12991668.html
Copyright © 2011-2022 走看看