Isomorphic JavaScript: The Future of Web AppsAt Airbnb, we’ve learned a lot over the past few years while building rich web experiences. We dove into ...
分类:
移动开发 时间:
2015-01-10 06:35:06
阅读次数:
197
实现多线程的方式有三种方法,1.继承Thread类2.实现Runnable接口3.实现Callable接口1,2两种方法差不多,Thread类也是实现了Runnable接口的。Runnable接口没有返回值而Callable接口是有返回值的,Callable有点像异步的回调,通过Future接口来接...
分类:
其他好文 时间:
2015-01-09 23:37:50
阅读次数:
252
Akka 设置延迟执行的Future_Patterns. after akka.pattern.Patterns.after makes it easy to complete a Future with a value or exception after a timeout. 代码如下, package?com.usoft;
import?akka.acto...
分类:
其他好文 时间:
2015-01-09 21:04:52
阅读次数:
272
-One such related pair of patterns is the concept
of an executor service that manages tasks and that of a thread pool that services tasks in
an efficient way.
-The new Callable interface, whic...
分类:
编程语言 时间:
2015-01-09 00:18:47
阅读次数:
365
Akka working with Future functionally_map方法 看代码, package?com.usoft;
import?akka.dispatch.ExecutionContexts;
import?akka.dispatch.Futures;
import?akka.dispatch.Mapper;
import?akka.dispat...
分类:
其他好文 时间:
2015-01-08 20:19:42
阅读次数:
182
Akka Actor_Future的使用 常见的是通过Actor的tell方法给另外一个actor发送消息,但是actor 和 future怎么交互,发送消息,如下, Future<Object>?future?=?Patterns.ask(a,?"are?you?ready?",?timeout);...
分类:
其他好文 时间:
2015-01-08 18:19:36
阅读次数:
261
今天看Curator源码时发现其请求ZooKeeper集群时内部封装了重试机制,代码如下:
Stat resultStat = RetryLoop.callWithRetry
(
client.getZookeeperClient(),
new Callable()
{...
Python中分为3种除法:传统除法、精确除法、地板除。传统除法:如果是整数除法则执行地板除,如果是浮点数除法则执行精确除法。>>>1/20>>>1.0/2.00.5精确除法:除法总是会返回真实的商,不管操作数是整形还是浮点型。执行from __future__ import division 指令...
分类:
其他好文 时间:
2015-01-07 23:22:26
阅读次数:
249
Java并发编程实践 目录并发编程 01—— ConcurrentHashMap并发编程 02—— 阻塞队列和生产者-消费者模式并发编程 03—— 闭锁CountDownLatch 与 栅栏CyclicBarrier并发编程 04—— Callable和Future并发编程 05—— Complet...
分类:
其他好文 时间:
2015-01-07 20:36:07
阅读次数:
167
装饰器是Python的一个特性,其实就是对callable对象的一个包装。下面是几个例子:1.修饰器自身不带有参数,那么AAA的参数就是func123456789def AAA(f):def wrapper(YYY):XXXf(YYY)return wrapper@AAAdef func(OOO):...
分类:
编程语言 时间:
2015-01-07 18:28:24
阅读次数:
209