Ce contenu n'est pas disponible dans la langue sélectionnée.
12.4. NotifyingFutures
Methods in Red Hat JBoss Data Grid do not return Java Development Kit (JDK)
Futures, but a sub-interface known as a NotifyingFuture. Unlike a JDK Future, a listener can be attached to a NotifyingFuture to notify the user about a completed future.
Note
NotifyingFutures are only available in JBoss Data Grid Library mode.
12.4.1. NotifyingFutures Example Copier lienLien copié sur presse-papiers!
Copier lienLien copié sur presse-papiers!
The following is an example depicting how to use
NotifyingFutures in Red Hat JBoss Data Grid:
Example 12.3. Configuring NotifyingFutures
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);