private Object getResult ( long timeout , TimeUnit unit ) throws InterruptedException , ExecutionException , TimeoutException { if ( ivCancelled ) { // F743-11774 if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "getResult: throwing CancellationException" ) ; } throw new CancellationException ( ) ; // F743-11774 } // Method ended with an exception if ( ivException != null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "getResult: " + ivException ) ; } throw new ExecutionException ( ivException ) ; } // F743-609CodRev // If the result object is itself a Future object, we need to call "get" on it // so that we unwrap the results and place them in this Future object. This // is done to support asynchronous method calls that return results wrapped // in Future objects, and also to support nested asynchronous method calls. // Also, note that "null" is an acceptable result. // F743-16193 // Remove instanceof check for Future object. Return type validation check // moved to EJBMDOrchestrator.java Object resultToReturn = null ; if ( ivFuture != null ) { // AsyncResult EJB3.2 API just throws IllegalStateExceptions for everything but .get(). // Even in EJB3.1 API get(timeout, unit) just immediately returned. In a long nested // chain of futures, only the last one will be AsyncResult so we won't need to pass // down the remaining timeout anyway. if ( ivFuture instanceof AsyncResult ) { resultToReturn = ivFuture . get ( ) ; } else { resultToReturn = ivFuture . get ( timeout , unit ) ; // d650178 } } return ( resultToReturn ) ; }
This get method returns the result of the asynch method call . This method must not be called unless ivGate indicates that results are available .