摘要: 1、ThreadLocal用于将变量封锁在线程内,不会涉及到资源的竞争。 2、Threadlocal的原理: Thread里面含有ThreadLocalMap对象,也就是每个线程都有这么一个map。 ThreadLocalMap的key是ThreadLocal对象,value是泛型的值。 阅读全文
posted @ 2016-02-27 14:42 YDDMAX 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 1、java有10个优先级,xp有7个,solaris则有2的31次幂个。一般建议不设置优先级,如果设置优先级的话,建议设置 Thread.MAX_PRIORITY; Thread.MIN_PRIORITY; Thread.NORM_PRIORITY;这三个优先级 1、任意时刻可以调用Thread. 阅读全文
posted @ 2016-02-27 11:57 YDDMAX 阅读(233) 评论(0) 推荐(0) 编辑
摘要: java的线程状态 A thread state. A thread can be in one of the following states: NEWA thread that has not yet started is in this state. RUNNABLEA thread exec 阅读全文
posted @ 2016-02-22 23:50 YDDMAX 阅读(1573) 评论(0) 推荐(0) 编辑
摘要: http://blog.csdn.net/a352193394/article/details/39323427 阅读全文
posted @ 2016-02-22 23:41 YDDMAX 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 提供了工厂方法: Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory, and Callable classes defined in this pack 阅读全文
posted @ 2016-02-22 23:32 YDDMAX 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 1、 2、ScheduledThreadPoolExecutor和Timer类似,可以设定一段时间delay之后或者按照一定的rate来执行任务。 3、ScheduledThreadPoolExecutor继承自ThreadPoolExecutor,但是ThreadPoolExecutor的一些AP 阅读全文
posted @ 2016-02-22 23:14 YDDMAX 阅读(216) 评论(0) 推荐(0) 编辑
摘要: 可以参考:http://blog.csdn.net/linghu_java/article/details/17123057 一、AbstractThreadPoolExecutor 该类是个抽象类,里面实现了ExecutorService的一些默认的实现。 二、ThreadPoolExecutor 阅读全文
posted @ 2016-02-22 13:42 YDDMAX 阅读(173) 评论(0) 推荐(0) 编辑
摘要: http://www.cnblogs.com/dolphin0520/p/3949310.html 一.Callable与Runnable 二.Future 三.FutureTask 四.使用示例 一.Callable与Runnable 先说一下java.lang.Runnable吧,它是一个接口, 阅读全文
posted @ 2016-02-20 23:00 YDDMAX 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 1、Executor是任务执行器,该接口里面只含有一个方法。原来创建新的线程都是采用new Thread(new Runnable())的方式创建,该接口将原来提交任务的方式进行了进一步的抽象。 /** * Executes the given command at some time in the 阅读全文
posted @ 2016-02-20 22:47 YDDMAX 阅读(234) 评论(0) 推荐(0) 编辑
摘要: 1、ToStringBuilder //对象及其属性一行显示 System.out.println(ToStringBuilder.reflectionToString(u)); System.out.println(ToStringBuilder.reflectionToString(u, ToS 阅读全文
posted @ 2016-02-19 11:00 YDDMAX 阅读(152) 评论(0) 推荐(0) 编辑