多线程 - Java里有类似Handler机制的类吗?
高洛峰
高洛峰 2017-04-17 13:53:36
0
3
245

就是一个线程得到了一些数据,通知另一个线程去处理
在android里可以通过给处理线程的Handler发送Message实现通知与数据传送
在JavaSE API环境下该怎么实现呢?
处理线程在没数据时要尽量少占用CPU时间

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all (3)
阿神

That is, asynchronous execution: you can look at the java.util.concurrent package.

Note: Interface Executor, Future, ExecutorService, etc.

Reference: http://www.cnblogs.com/hzmark/archive/2013/01/21/JavaExecutor.html and its series of blog posts.

    Ty80

    Future is used for this callback notification. In fact, it is implemented by passing the interface. In java, callback notification can be made through the interface

      阿神

      handler is an asynchronous callback. Then it’s Future and callback

        Latest Downloads
        More>
        Web Effects
        Website Source Code
        Website Materials
        Front End Template
        About us Disclaimer Sitemap
        php.cn:Public welfare online PHP training,Help PHP learners grow quickly!