net.tomp2p.futures
Class BaseFutureAdapter<F extends BaseFuture>

java.lang.Object
  extended by net.tomp2p.futures.BaseFutureAdapter<F>
Type Parameters:
F -
All Implemented Interfaces:
BaseFutureListener<F>

public abstract class BaseFutureAdapter<F extends BaseFuture>
extends Object
implements BaseFutureListener<F>

The BaseFuture always completes either successfully or failed. In either case a BaseFutureListener is called. If this future fails, then exception is caught. Since this should never happen in this framework, we use an adapter where we only have to define BaseFutureListener#operationComplete(BaseFuture). Since the future is exposed to the application, that may have exceptions in the listener, developers should rather use BaseFutureListener#operationComplete(BaseFuture).

Author:
Thomas Bocek

Constructor Summary
BaseFutureAdapter()
           
 
Method Summary
 void exceptionCaught(Throwable t)
          Prints out the error using the logger and System.err.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.tomp2p.futures.BaseFutureListener
operationComplete
 

Constructor Detail

BaseFutureAdapter

public BaseFutureAdapter()
Method Detail

exceptionCaught

public void exceptionCaught(Throwable t)
                     throws Exception
Prints out the error using the logger and System.err.

Specified by:
exceptionCaught in interface BaseFutureListener<F extends BaseFuture>
Parameters:
t - The exception thrown in #operationComplete(BaseFuture).
Throws:
Exception - If an execption is thrown, it is printed in the log and and System.err


Copyright © 2013. All Rights Reserved.