当前位置: 首页 > news >正文

网站建设需要的费用科技为了上大学上交可控核聚变

网站建设需要的费用,科技为了上大学上交可控核聚变,wordpress 重置,wordpress 模板 橱窗文章目录 线程池的拒绝策略AbortPolicy拒绝策略#xff1a;CallerRunsPolicy拒绝策略#xff1a;DiscardOldestPolicy拒绝策略#xff1a;DiscardPolicy拒绝策略#xff1a; 线程池的拒绝策略 若在线程池当中的核心线程数已被用完且阻塞队列已排满#xff0c;则此时线程池… 文章目录 线程池的拒绝策略AbortPolicy拒绝策略CallerRunsPolicy拒绝策略DiscardOldestPolicy拒绝策略DiscardPolicy拒绝策略 线程池的拒绝策略 若在线程池当中的核心线程数已被用完且阻塞队列已排满则此时线程池的线程资源已耗尽线程池没有足够的线程资源执行新的任务。 所以为了保证操作系统的安全性线程池将通过拒绝策略来处理新添加的线程任务。 JDK 中内置的拒绝策略有 AbortPolicyCallerRunsPolicy、DiscardOldestPolicy、DiscardPolicy 这4种默认的拒绝策略在 ThreadPoolExecutor 中作为内部类来进行提供的在默认的拒绝策略都不能满足应用的需求时也可以自定义拒绝策略。 AbortPolicy拒绝策略 该策略会直接抛出异常阻止系统正常工作。 jdk源码 /*** A handler for rejected tasks that throws a* {code RejectedExecutionException}.*/public static class AbortPolicy implements RejectedExecutionHandler {/*** Creates an {code AbortPolicy}.*/public AbortPolicy() { }/*** Always throws RejectedExecutionException.** param r the runnable task requested to be executed* param e the executor attempting to execute this task* throws RejectedExecutionException always*/public void rejectedExecution(Runnable r, ThreadPoolExecutor e) {throw new RejectedExecutionException(Task r.toString() rejected from e.toString());}}CallerRunsPolicy拒绝策略 如果线程池的线程数量达到上限该策略会把任务队列中的任务放在调用者线程如main函数当中运行。 jdk源码 /*** A handler for rejected tasks that runs the rejected task* directly in the calling thread of the {code execute} method,* unless the executor has been shut down, in which case the task* is discarded.*/public static class CallerRunsPolicy implements RejectedExecutionHandler {/*** Creates a {code CallerRunsPolicy}.*/public CallerRunsPolicy() { }/*** Executes task r in the callers thread, unless the executor* has been shut down, in which case the task is discarded.** param r the runnable task requested to be executed* param e the executor attempting to execute this task*/public void rejectedExecution(Runnable r, ThreadPoolExecutor e) {if (!e.isShutdown()) {r.run();}}}DiscardOldestPolicy拒绝策略 该策略将移除最早的一个请求也就是即将被执 行的任务然后并尝试再次提交当前的任务。 jdk源码 /*** A handler for rejected tasks that discards the oldest unhandled* request and then retries {code execute}, unless the executor* is shut down, in which case the task is discarded.*/public static class DiscardOldestPolicy implements RejectedExecutionHandler {/*** Creates a {code DiscardOldestPolicy} for the given executor.*/public DiscardOldestPolicy() { }/*** Obtains and ignores the next task that the executor* would otherwise execute, if one is immediately available,* and then retries execution of task r, unless the executor* is shut down, in which case task r is instead discarded.** param r the runnable task requested to be executed* param e the executor attempting to execute this task*/public void rejectedExecution(Runnable r, ThreadPoolExecutor e) {if (!e.isShutdown()) {e.getQueue().poll();e.execute(r);}}}DiscardPolicy拒绝策略 丢弃当前线程任务而不做任何处理。如果系统允许在资源不足的情况下丢弃部分任务则这将是保障系统安全稳定的一种很好的方案。 jdk源码 /*** A handler for rejected tasks that silently discards the* rejected task.*/public static class DiscardPolicy implements RejectedExecutionHandler {/*** Creates a {code DiscardPolicy}.*/public DiscardPolicy() { }/*** Does nothing, which has the effect of discarding task r.** param r the runnable task requested to be executed* param e the executor attempting to execute this task*/public void rejectedExecution(Runnable r, ThreadPoolExecutor e) {}}以上4种拒绝策略均是实现的 RejectedExecutionHandler 接口来实现拒绝策略若无法满足实际需要则用户就可以自己自定义来实现拒绝策略。
http://www.dnsts.com.cn/news/101701.html

相关文章:

  • 织梦网站源文件没有style文件夹怎么修改网站背景郑州中航软件开发有限公司
  • 网站建设与运营财务报表90设计怎么免费下载
  • 绍兴做外贸网站的公司中国建设银行北京市分行网站
  • 网站做一年了没做301北京WordPress爱好者
  • 专业网站是什么意思建设规范文件在哪个网站发布
  • 聊城市城乡建设部网站查询广州白云最新消息
  • 专门做ppt的网站名称视频网站开发问题
  • 网站建设空心正方形安徽 电子政务网站定制
  • 北京网站如何制作海外网络推广专员招聘
  • 网站备案更改住房和城乡建设部网站 城市绿地分类
  • 自己专业做网站即将发布的新品手机
  • 浏览器正能量网站免费百度普通下载
  • 网站建设思维导图模板学影视后期大概多少钱
  • 做动漫的游戏 迅雷下载网站私密浏览器免费观看
  • 做网站后台要学什么深圳网站外包公司
  • 网站备份流程网站如何发布和推广
  • 建设银行网站查询密码怎么设置关于重新建设网站的申请
  • 武昌网站制作建设企业网站建设的策划书
  • python自学网站出口商出口外贸流程
  • 游戏网站织梦模板数据库检索网站建设
  • 建立企业网站公司微网站制作速成法
  • 自助建站自媒体小程序分销怎么做好分销
  • 对于网站反爬虫如何做网站建设技术人员要求
  • 永济市网站建设wordpress打分
  • 网站空间购买北京天眼查询个人信息
  • 网站首页翻转效果什么模块怎样建立公司网页
  • 搜关键词可以搜到的网站怎么做滴滴出行网站建设
  • 中心网站设计电脑dw怎么制作网页
  • 最好的建站网站做新网站 备案证明交接
  • 嘉伟网络智能建站拖拽式网站