【Tech-Android-Other】Android中的Future
来源:互联网 发布:matlab多变量数据拟合 编辑:程序博客网 时间:2024/05/17 23:25
Future
Future
that isRunnable
. RunnableScheduledFuture<V>A ScheduledFuture
that isRunnable
. ScheduledFuture<V>A delayed result-bearing action that can be cancelled. Class Overview
A Future represents the result of an asynchronous computation. Methods are provided to check if the computation is complete, to wait for its completion, and to retrieve the result of the computation. The result can only be retrieved using methodget when the computation has completed, blocking if necessary until it is ready. Cancellation is performed by thecancel method. Additional methods are provided to determine if the task completed normally or was cancelled. Once a computation has completed, the computation cannot be cancelled. If you would like to use aFuture for the sake of cancellability but not provide a usable result, you can declare types of the formFuture<?>
and return null as a result of the underlying task.
FutureTask
extends Objectimplements RunnableFuture<V>
Class Overview
A cancellable asynchronous computation. This class provides a base implementation ofFuture
, with methods to start and cancel a computation, query to see if the computation is complete, and retrieve the result of the computation. The result can only be retrieved when the computation has completed; theget method will block if the computation has not yet completed. Once the computation has completed, the computation cannot be restarted or cancelled.
A FutureTask can be used to wrap a Callable
orRunnable
object. BecauseFutureTask implements Runnable, a FutureTask can be submitted to anExecutor
for execution.
In addition to serving as a standalone class, this class provides protected functionality that may be useful when creating customized task classes.
一个可取消的异步运算,这个类实现了Fututre的借口,可以开始和取消一个运算操作,判断这个操作是否已经完成了,和重新得到运算操作的结果。运算的结果仅仅在运算结束完成后被恢复,get的方法将会阻塞程序,如果这个运算操作还没有完成的话。一旦运算操作完成了,这个操作就不能重新开始或者取消了。
这个类过去常常用于包装一个Callable or Runnable 类的。因为FutureTask实现了runnable借口,一个FutureTask可以实现线程池中的execution方法。
除了是一个单独的类之外,这个类还提供了可能有之用途定制任务classed的保护功能.
- 【Tech-Android-Other】Android中的Future
- 【Tech-Android-Other】Android中的内存管理的工具使用方法
- 【Tech-Android-Other】android中的Parcelable的实现
- 【Tech-Android-Other】Android开发中的IO优化
- 【Tech-Android-Other】Android中的网络类型获取与处理
- 【Tech-Android-Other】Android性能优化
- 【Tech-Android-Other】Android的一些Dug
- 【Tech-Android-Other】Android性能优化
- 【Tech-Android-Other】Android性能优化
- 【Tech-Android-Other】Android性能优化
- 【Tech-Android-Other】Java内存管理
- 【Tech-Android-Other】android操作sdcard中的多媒体文件——音乐列表的更新
- 【Tech-Android-Other】Android中保存界面状态
- 【Tech-Android-Other】Android中有效自定义View的注意事项
- 【Tech-Android-Other】Android创建应用的桌面的快捷方式
- 【Tech-Android-Other】CheckTextView多选的使用
- 【Tech-Android-Other】高效拼接一个GET请求URL
- 【Tech-Android-Other】Eclipse常用快捷键和使用技巧
- UC手游平台九游已成与91手机助手、360并列的国内三大手机游戏平台
- 先装ubuntu10.10再装windows7简单步骤(很简单)
- 在ubuntu 10.04中下载Android源码
- 软件测试体系方案
- 掌握shell编程中数组的常见用法及示例
- 【Tech-Android-Other】Android中的Future
- BO的designer学习
- Linux必学的60个命令
- ios之导航控制器(Nav)
- 摇一摇 聊一聊:新媒体下的欲望
- UIView层次管理
- Linux 索引节点
- 《网络科学-原理与应用》要点总结1——图论
- Android面试题集锦