开发AndroidAPP经常会使用AsyncTask框架来异步加载资源或者异步到服务器拉消息,等任务完成后再主动更新结果到UI主线程,AsyncTask框架可以非常方便的获取线程异步执行结果。Java5之前,Java并没有提供API用于查询线程是否执行完毕以及如何获取线程执行的结果;Java5之后版本提..
分类:
其他好文 时间:
2014-11-14 18:04:57
阅读次数:
249
Java并发编程实践 目录并发编程 01—— ConcurrentHashMap并发编程 02—— 阻塞队列和生产者-消费者模式并发编程 03—— 闭锁CountDownLatch 与 栅栏CyclicBarrier并发编程 04—— Callable和Future并发编程 05—— Complet...
分类:
其他好文 时间:
2014-11-13 16:19:13
阅读次数:
175
如果对象object参数是可以调用的对象,就返回True;否则返回False。不过要注意的是,当一个对象是可以调用的,并不表示调用该对象时执行一定成功,但不可调用的对象去调用时一定不会成功。如果类对象是一个类对象,那么这个类是否重载有__call__()方法来决定,如果重载有这个方法就判断为True。例子:#callable()函数
a = 'abc'
def f(a):
pass
...
分类:
编程语言 时间:
2014-11-07 16:58:40
阅读次数:
170
OK. I have been trying to learn github for really a long time, but (yes, there is always a but) I just couldn't know how to use it. This article will ...
分类:
其他好文 时间:
2014-11-04 06:45:35
阅读次数:
145
Executor和ExecutorService、Executors类方便创建线程池、Callable和Runnable、Future和FutureTask,以及Executor相关类的结构...
分类:
其他好文 时间:
2014-11-03 16:26:56
阅读次数:
273
Callable方法比Runnable强大一些在于它被线程执行后有返回值,该返回值可以被Future拿到。用法:Callable<Integer>callable=newCallable<Integer>(){publicIntegercall()throwsException{//dosth}};FutureTask<Integer>future=newFutureTask<Integer>(..
分类:
其他好文 时间:
2014-11-01 19:17:29
阅读次数:
175
Timer的官方描述是:A facility for threads to schedule tasks for future execution in a background thread.
Tasks may be scheduled for one-time execution, or for repeated execution at regular intervals.
意思就是...
分类:
其他好文 时间:
2014-11-01 17:52:47
阅读次数:
169
java线程中Callable与Future...
分类:
编程语言 时间:
2014-10-30 22:49:30
阅读次数:
276
微软近期Open的职位:MSIT Dynamics CRM Sr. Dev Lead (Sr. Dev Lead, Microsoft China, Beijing)Are you interested in shaping the future vision of how we implement...
分类:
其他好文 时间:
2014-10-28 13:34:24
阅读次数:
145
Java并发编程实践 目录并发编程 01—— ConcurrentHashMap并发编程 02—— 阻塞队列和生产者-消费者模式并发编程 03—— 闭锁CountDownLatch 与 栅栏CyclicBarrier并发编程 04—— Callable和Future并发编程 05—— Complet...
分类:
其他好文 时间:
2014-10-27 21:04:17
阅读次数:
231