Code example for Callable

Methods: call

0
      // hook into lifecycle 
      DistributedTaskLifecycleService taskLifecycleService = DistributedTaskLifecycleService.getInstance();
      Callable<V> callable = getCallable();
      V result = null;
      try { 
         taskLifecycleService.onPreExecute(callable, cache);
         if (callable instanceof DistributedCallable<?, ?, ?>) {
            DistributedCallable<Object, Object, Object> dc = (DistributedCallable<Object, Object, Object>) callable;
            dc.setEnvironment(cache, keys); 
         } 
         result = callable.call();
      } finally { 
         taskLifecycleService.onPostExecute(callable);
      } 
      return result;
   } 
 
   public Callable<V> getCallable() {
      return callable;
   }