
java基础
文章平均质量分 90
Andyzhu_2005
这个作者很懒,什么都没留下…
展开
-
Thread类中的中断分析
interrupt()分析先看javadoc里的关于Thread类的interrupt()方法说明Interrupts this thread. Unless the current thread is interrupting itself, which is always permitted, the checkAccess method of this thread is invok...原创 2018-09-28 16:32:45 · 364 阅读 · 0 评论 -
java异步调用future、callable以及futuretask分析
通过线程池的submit方法和实现了callable接口的对象,可以返回一个future接口的对象,通过此对象可以异步获取callable方法的运行结果。future.get() 阻塞式的返回结果,如果任务未执行完毕,就阻塞等待结果产生。future.get(10000, TimeUnit.MILLISECONDS); 在时间范围内得到结果,没有的话就报错public class Fut...原创 2018-09-29 09:34:15 · 690 阅读 · 0 评论