Package org.infinispan.distexec.spi

Examples of org.infinispan.distexec.spi.DistributedTaskLifecycleService


               }

               private Object doLocalInvoke() {
                  Object result = null;
                  getCommand().init(cache);
                  DistributedTaskLifecycleService lifecycle = DistributedTaskLifecycleService.getInstance();
                  try {
                     // hook into lifecycle
                     lifecycle.onPreExecute(getCommand().getCallable(), cache);
                     cancellationService.register(Thread.currentThread(), getCommand().getUUID());
                     result = getCommand().perform(null);
                     return Collections.singletonMap(getAddress(),
                              SuccessfulResponse.create(result));
                  } catch (Throwable e) {
                     return e;
                  } finally {
                     // hook into lifecycle
                     lifecycle.onPostExecute(getCommand().getCallable());
                     cancellationService.unregister(getCommand().getUUID());
                     notifyDone();
                  }
               }
            };
View Full Code Here


    * @return result of Callable invocations
    */
   @Override
   public Object perform(InvocationContext context) throws Throwable {
      // 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;
   }
View Full Code Here

                  return doLocalInvoke();
               }

               private V doLocalInvoke() throws Exception {
                  getCommand().init(cache);
                  DistributedTaskLifecycleService lifecycle = DistributedTaskLifecycleService.getInstance();
                  try {
                     // hook into lifecycle
                     lifecycle.onPreExecute(getCommand().getCallable(), cache);
                     cancellationService.register(Thread.currentThread(), getCommand().getUUID());
                     V result = getCommand().perform(null);
                     future.notifyDone(result);
                     return result;
                  } catch (Exception e) {
                     future.notifyException(e);
                     throw e;
                  } finally {
                     // hook into lifecycle
                     lifecycle.onPostExecute(getCommand().getCallable());
                     cancellationService.unregister(getCommand().getUUID());
                  }
               }
            };
            future.setFuture(localExecutorService.submit(call));
View Full Code Here

               }

               private Object doLocalInvoke() {
                  Object result = null;
                  getCommand().init(cache);
                  DistributedTaskLifecycleService lifecycle = DistributedTaskLifecycleService.getInstance();
                  try {
                     // hook into lifecycle
                     lifecycle.onPreExecute(getCommand().getCallable(), cache);
                     cancellationService.register(Thread.currentThread(), getCommand().getUUID());
                     result = getCommand().perform(null);
                     return Collections.singletonMap(getAddress(),
                              SuccessfulResponse.create(result));
                  } catch (Throwable e) {
                     return e;
                  } finally {
                     // hook into lifecycle
                     lifecycle.onPostExecute(getCommand().getCallable());
                     cancellationService.unregister(getCommand().getUUID());
                     notifyDone();
                  }
               }
            };
View Full Code Here

    * @return result of Callable invocations
    */
   @Override
   public Object perform(InvocationContext context) throws Throwable {
      // 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;
   }
View Full Code Here

               }

               private Object doLocalInvoke() {
                  Object result = null;
                  getCommand().init(cache);
                  DistributedTaskLifecycleService lifecycle = DistributedTaskLifecycleService.getInstance();
                  try {
                     // hook into lifecycle
                     lifecycle.onPreExecute(getCommand().getCallable(), cache);
                     cancellationService.register(Thread.currentThread(), getCommand().getUUID());
                     result = getCommand().perform(null);
                     return Collections.singletonMap(getAddress(),
                              SuccessfulResponse.create(result));
                  } catch (Throwable e) {
                     return e;
                  } finally {
                     // hook into lifecycle
                     lifecycle.onPostExecute(getCommand().getCallable());
                     cancellationService.unregister(getCommand().getUUID());
                     notifyDone();
                  }
               }
            };
View Full Code Here

               }

               private Object doLocalInvoke() {
                  Object result = null;
                  getCommand().init(cache);
                  DistributedTaskLifecycleService lifecycle = DistributedTaskLifecycleService.getInstance();
                  try {
                     // hook into lifecycle
                     lifecycle.onPreExecute(getCommand().getCallable(), cache);
                     cancellationService.register(Thread.currentThread(), getCommand().getUUID());
                     result = getCommand().perform(null);
                     return Collections.singletonMap(getAddress(),
                              SuccessfulResponse.create(result));
                  } catch (Throwable e) {
                     return e;
                  } finally {
                     // hook into lifecycle
                     lifecycle.onPostExecute(getCommand().getCallable());
                     cancellationService.unregister(getCommand().getUUID());
                     notifyDone();
                  }
               }
            };
View Full Code Here

               }

               private Object doLocalInvoke() {
                  Object result = null;
                  getCommand().init(cache);
                  DistributedTaskLifecycleService lifecycle = DistributedTaskLifecycleService.getInstance();
                  try {
                     // hook into lifecycle
                     lifecycle.onPreExecute(getCommand().getCallable(), cache);
                     cancellationService.register(Thread.currentThread(), getCommand().getUUID());
                     result = getCommand().perform(null);
                     return Collections.singletonMap(getAddress(),
                              SuccessfulResponse.create(result));
                  } catch (Throwable e) {
                     return e;
                  } finally {
                     // hook into lifecycle
                     lifecycle.onPostExecute(getCommand().getCallable());
                     cancellationService.unregister(getCommand().getUUID());
                     notifyDone();
                  }
               }
            };
View Full Code Here

               }

               private Object doLocalInvoke() {
                  Object result = null;
                  getCommand().init(cache);
                  DistributedTaskLifecycleService lifecycle = DistributedTaskLifecycleService.getInstance();
                  try {
                     // hook into lifecycle
                     lifecycle.onPreExecute(getCommand().getCallable(), cache);
                     cancellationService.register(Thread.currentThread(), getCommand().getUUID());
                     result = getCommand().perform(null);
                     return Collections.singletonMap(getAddress(),
                              SuccessfulResponse.create(result));
                  } catch (Throwable e) {
                     return e;
                  } finally {
                     // hook into lifecycle
                     lifecycle.onPostExecute(getCommand().getCallable());
                     cancellationService.unregister(getCommand().getUUID());
                     notifyDone();
                  }
               }
            };
View Full Code Here

            @Override
            public Object call() throws Exception {
               Object result = null;
               future.getCommand().init(cache);
               DistributedTaskLifecycleService taskLifecycleService = DistributedTaskLifecycleService.getInstance();
               try {
                  //hook into lifecycle
                  taskLifecycleService.onPreExecute(future.getCommand().getCallable());
                  result = future.getCommand().perform(null);
                  return Collections.singletonMap(rpc.getAddress(), SuccessfulResponse.create(result));
               } catch (Throwable e) {
                  return e;
               } finally {
                  //hook into lifecycle
                  taskLifecycleService.onPostExecute(future.getCommand().getCallable());
                  future.notifyDone();
               }
            }
         };
         final FutureTask<Object> task = new FutureTask<Object>(call);
View Full Code Here

TOP

Related Classes of org.infinispan.distexec.spi.DistributedTaskLifecycleService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.