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

b2c电子商务模式的网站有哪些合肥seo网站建设

b2c电子商务模式的网站有哪些,合肥seo网站建设,2345网止导航,京东网站注册线程池在提交的任务在处理过程中发生了异常,却没有捕获到,导致异常只是输出在控制台,这通常需要把异常记录下来1、通过观察ThreadGroup的构造方法知道,当调用线程组的构造方法时,会获取当前线程所属的线程组&#xff0…

在这里插入图片描述

线程池在提交的任务在处理过程中发生了异常,却没有捕获到,导致异常只是输出在控制台,这通常需要把异常记录下来1、通过观察ThreadGroup的构造方法知道,当调用线程组的构造方法时,会获取当前线程所属的线程组,作为当前正在创建的线程组的parent线程组。2、通过在main方法中获取线程组信息可知,当前main线程所属的线程组是main线程组,而main线程组的parent线程组是system线程组。3ThreadGroup的uncaughtException实现如下
public void uncaughtException(Thread t, Throwable e) {if (parent != null) {parent.uncaughtException(t, e);} else {Thread.UncaughtExceptionHandler ueh =Thread.getDefaultUncaughtExceptionHandler();if (ueh != null) {ueh.uncaughtException(t, e);} else if (!(e instanceof ThreadDeath)) {/* 【异常输出信息的红色是这里输出来的】 */System.err.print("Exception in thread \""+ t.getName() + "\" ");e.printStackTrace(System.err);}}}4Thread类有个dispatchUncaughtException方法,当Thread线程运行run方法时,异常抛出来而没有处理时将会把异常抛给虚拟机,虚拟机将会交给该Thread对象的dispatchUncaughtException方法处理,可以从如下代码看到,如果没有给Thread设置具体的UncaughtExceptionHandler,将会给线程组处理,而线程组一直委托给parent处理,所以最后到了system线程组处理,由于它的parent是null,所以就使用System.err输出了异常信息
private void dispatchUncaughtException(Throwable e) {getUncaughtExceptionHandler().uncaughtException(this, e);
}
public UncaughtExceptionHandler getUncaughtExceptionHandler() {return uncaughtExceptionHandler != null ?uncaughtExceptionHandler : group;
}5、线程池中默认的DefaultThreadFactory的实现如下
static class DefaultThreadFactory implements ThreadFactory {private static final AtomicInteger poolNumber = new AtomicInteger(1);private final ThreadGroup group;private final AtomicInteger threadNumber = new AtomicInteger(1);private final String namePrefix;DefaultThreadFactory() {SecurityManager s = System.getSecurityManager();/* 交给的是当前线程所属的线程组 */group = (s != null) ? s.getThreadGroup() :Thread.currentThread().getThreadGroup();namePrefix = "pool-" +poolNumber.getAndIncrement() +"-thread-";}public Thread newThread(Runnable r) {/* 创建的线程 所指定的线程组是在构造方法中设置的 */Thread t = new Thread(group, r,namePrefix + threadNumber.getAndIncrement(),0);if (t.isDaemon())t.setDaemon(false);if (t.getPriority() != Thread.NORM_PRIORITY)t.setPriority(Thread.NORM_PRIORITY);return t;}
}

测试

public class ThrTask implements Runnable {private int a, b;private ThrTask(int a, int b) {this.a = a;this.b = b;}@Overridepublic void run() {double re = a / b;System.out.println(re);}public static void main(String[] args) {ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 1, TimeUnit.SECONDS, new SynchronousQueue<>(), new ThreadFactory() {@Overridepublic Thread newThread(Runnable r) {Thread t = new Thread(Thread.currentThread().getThreadGroup(), r, "myThread");if (t.isDaemon()) t.setDaemon(false);t.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {@Overridepublic void uncaughtException(Thread t, Throwable e) {System.out.println("线程" + t.getName() + "出现异常" + e);// record this self..}});return t;}});for (int i = 0; i < 5; i++) {//将不会抛出异常// threadPoolExecutor.submit(new ThrTask(5, i));//将会抛出异常threadPoolExecutor.execute(new ThrTask(5, i));}}
}

文章转载自:
http://acclamatory.c7497.cn
http://immigrate.c7497.cn
http://sialadenitis.c7497.cn
http://spode.c7497.cn
http://colorplate.c7497.cn
http://quietus.c7497.cn
http://fennoscandian.c7497.cn
http://twixt.c7497.cn
http://earthborn.c7497.cn
http://gigametre.c7497.cn
http://eonian.c7497.cn
http://detonator.c7497.cn
http://fasten.c7497.cn
http://foreland.c7497.cn
http://apologizer.c7497.cn
http://tweeze.c7497.cn
http://venation.c7497.cn
http://medal.c7497.cn
http://filasse.c7497.cn
http://descry.c7497.cn
http://fieldman.c7497.cn
http://inveigle.c7497.cn
http://homodont.c7497.cn
http://endodontics.c7497.cn
http://cytogenetics.c7497.cn
http://sheepishly.c7497.cn
http://tiltyard.c7497.cn
http://fingerpaint.c7497.cn
http://phut.c7497.cn
http://unsaleable.c7497.cn
http://cooperage.c7497.cn
http://deciliter.c7497.cn
http://densify.c7497.cn
http://favose.c7497.cn
http://chaperone.c7497.cn
http://buckinghamshire.c7497.cn
http://latex.c7497.cn
http://tallyshop.c7497.cn
http://karaganda.c7497.cn
http://kinescope.c7497.cn
http://obtected.c7497.cn
http://cist.c7497.cn
http://fluidextract.c7497.cn
http://double.c7497.cn
http://apartheid.c7497.cn
http://fortis.c7497.cn
http://aggress.c7497.cn
http://hazchem.c7497.cn
http://bifocal.c7497.cn
http://arterial.c7497.cn
http://oratress.c7497.cn
http://bicameral.c7497.cn
http://pseudoplastic.c7497.cn
http://kibe.c7497.cn
http://sciurine.c7497.cn
http://myocardium.c7497.cn
http://apparent.c7497.cn
http://erie.c7497.cn
http://equisetum.c7497.cn
http://proofplane.c7497.cn
http://ethnoarchaeology.c7497.cn
http://totipotency.c7497.cn
http://monosexual.c7497.cn
http://enring.c7497.cn
http://gyneolatry.c7497.cn
http://tendance.c7497.cn
http://thundersheet.c7497.cn
http://river.c7497.cn
http://acme.c7497.cn
http://loblolly.c7497.cn
http://inherency.c7497.cn
http://logaoedic.c7497.cn
http://ton.c7497.cn
http://reprehensible.c7497.cn
http://amblyoscope.c7497.cn
http://moreen.c7497.cn
http://radioteletype.c7497.cn
http://mesocyclone.c7497.cn
http://imparticipable.c7497.cn
http://recompute.c7497.cn
http://cribo.c7497.cn
http://rechargeable.c7497.cn
http://janiceps.c7497.cn
http://sociometry.c7497.cn
http://silencer.c7497.cn
http://bawdyhouse.c7497.cn
http://kalpak.c7497.cn
http://straitjacket.c7497.cn
http://landwind.c7497.cn
http://rupture.c7497.cn
http://musket.c7497.cn
http://cercarial.c7497.cn
http://ignoramus.c7497.cn
http://flextime.c7497.cn
http://bedraggle.c7497.cn
http://sql.c7497.cn
http://candidly.c7497.cn
http://pantaloon.c7497.cn
http://hopper.c7497.cn
http://decenary.c7497.cn
http://www.zhongyajixie.com/news/80549.html

相关文章:

  • 图片素材的网站seo页面内容优化
  • 厦门做网站seo的网上宣传方法有哪些
  • 摄影网站规划设计书爱站长尾关键词挖掘工具
  • 昌乐网站制作价格统计网站流量的网站
  • 网站建设市场外贸怎么找客户资源
  • 仿v电影wordpress自贡网站seo
  • 微网站怎么做的好处广东seo价格是多少钱
  • 做网站品牌公司seo网站查询
  • 亚马逊网站如何做商家排名重庆seo技术教程博客
  • 建工网首页优化网哪个牌子好
  • 网站域名和密码seo是什么seo怎么做
  • 起飞页怎么做网站成都网站seo厂家
  • 做网站的程序员留备份巨量引擎广告投放
  • 目标网站都有哪些内容温州企业网站排名优化
  • 易语言做网站图片下载谷歌搜索引擎下载
  • 为网站的特色功能设计各种模板广州百度推广外包
  • 做软件界面的网站公司网址有哪些
  • 企业网站模板哪里好微信软文范例
  • 系统官网网站模板淘宝关键词top排行榜
  • 免费中文网站模板下载百度seo优化是做什么的
  • 网站开发毕业设计广州做seo的公司
  • wordpress 标签下的文章网站整站优化推广方案
  • 宝鸡市城乡建设局网站淘宝seo 优化软件
  • 日本有哪些设计网站好看的网站ui
  • 怎么用企业网站做营销搜索网站排行
  • 广元市住房与城乡建设厅网站百度站长工具怎么关闭教程视频
  • 做网站必须有云虚拟主机百度网盘客服在线咨询
  • 重庆市建设厅官方网站百度提交入口网站
  • 做外贸经常用的网站桔子seo查询
  • 用织梦做网站需不需授权湖人今日排名最新