Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.0.0)

E17493-01

oracle.ide.model.concurrent
Interface CallableResultHandler<T>


public interface CallableResultHandler<T>

Used by AsynchronousCallableCompletionService to specify a callback class, whose methods are called with the result (or exception) of the Callable submitted to the service.

Usage Example

 class AddToListCallableImpl implements CallableResultHandler 
 {
    final List resultList = Collections.synchronizedList(new ArrayList());
    final List errorList = Collections.synchronizedList(new ArrayList());
                
    public void onCompletion(Integer resultFromAsynchronousOperation) {
       resultList.add(resultFromAsynchronousOperation);
       // Do stuff with the result ... 
    }

    public void onException(ExecutionException executionException) {
       errorList.add(executionException);
       executionException.printStackTrace();
    }
 }
 


Method Summary
 void onCompletion(T resultOfCallable)
          Invoked with the result of the Callable submitted to AsynchronousCallableCompletionService.submit(Callable).
 void onException(java.util.concurrent.ExecutionException executionException)
          Invoked with the ExecutionException of the Callable submitted to AsynchronousCallableCompletionService.submit(Callable).
 

Method Detail

onCompletion

void onCompletion(T resultOfCallable)
Invoked with the result of the Callable submitted to AsynchronousCallableCompletionService.submit(Callable).

Parameters:
resultOfCallable - the Callable's result.

onException

void onException(java.util.concurrent.ExecutionException executionException)
Invoked with the ExecutionException of the Callable submitted to AsynchronousCallableCompletionService.submit(Callable).

Parameters:
executionException - the Callable's exception. Use Throwable.getCause() to determine the cause.

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.0.0)

E17493-01

Copyright © 1997, 2011, Oracle. All rights reserved.