3.4.3. future の通知
厳密には、これらのメソッドは JDK Futures を返さず、NotifyingFuture として知られるサブインターフェースです。 主な違いは、今後の完了時に通知できるように、リスナーを NotifyingFuture にアタッチできることです。 以下は、通知の future を使用する例です。
FutureListener futureListener = new FutureListener() {
public void futureDone(Future future) {
try {
future.get();
} catch (Exception e) {
// Future did not complete successfully
System.out.println("Help!");
}
}
};
cache.putAsync("key", "value").attachListener(futureListener);