Examples of AsyncExecutor


Examples of bitronix.tm.twopc.executor.AsyncExecutor

    public static Executor getExecutor() {
        Executor executor = executorRef.get();
        if (executor == null) {
            if (getConfiguration().isAsynchronous2Pc()) {
                if (log.isDebugEnabled()) { log.debug("using AsyncExecutor"); }
                executor = new AsyncExecutor();
            } else {
                if (log.isDebugEnabled()) { log.debug("using SyncExecutor"); }
                executor = new SyncExecutor();
            }
            if (!executorRef.compareAndSet(null, executor)) {
View Full Code Here

Examples of com.amazonaws.services.simpleworkflow.flow.interceptors.AsyncExecutor

    @Around("execution(@com.amazonaws.services.simpleworkflow.flow.annotations.ExponentialRetry * *(..)) && @annotation(retryAnnotation)")
    public Object retry(final ProceedingJoinPoint pjp, ExponentialRetry retryAnnotation) throws Throwable {
        ExponentialRetryPolicy retryPolicy = createExponentialRetryPolicy(retryAnnotation);

        WorkflowClock clock = new DecisionContextProviderImpl().getDecisionContext().getWorkflowClock();
        AsyncExecutor executor = new AsyncRetryingExecutor(retryPolicy, clock);

        Settable<?> result;
        if (isVoidReturnType(pjp)) {
            result = null;
        }
        else {
            result = new Settable<Object>();
        }
        DecoratorInvocationHandler handler = new DecoratorInvocationHandler(pjp, result);
        executor.execute(handler);
        return result;
    }
View Full Code Here

Examples of com.amazonaws.services.simpleworkflow.flow.interceptors.AsyncExecutor

    @Around("execution(@com.amazonaws.services.simpleworkflow.flow.annotations.ExponentialRetry * *(..)) && @annotation(retryAnnotation)")
    public Object retry(final ProceedingJoinPoint pjp, ExponentialRetry retryAnnotation) throws Throwable {
        ExponentialRetryPolicy retryPolicy = createExponentialRetryPolicy(retryAnnotation);

        WorkflowClock clock = new DecisionContextProviderImpl().getDecisionContext().getWorkflowClock();
        AsyncExecutor executor = new AsyncRetryingExecutor(retryPolicy, clock);

        Settable<?> result;
        if (isVoidReturnType(pjp)) {
            result = null;
        }
        else {
            result = new Settable<Object>();
        }
        DecoratorInvocationHandler handler = new DecoratorInvocationHandler(pjp, result);
        executor.execute(handler);
        return result;
    }
View Full Code Here

Examples of com.amazonaws.services.simpleworkflow.flow.interceptors.AsyncExecutor

    @Around("execution(@com.amazonaws.services.simpleworkflow.flow.annotations.ExponentialRetry * *(..)) && @annotation(retryAnnotation)")
    public Object retry(final ProceedingJoinPoint pjp, ExponentialRetry retryAnnotation) throws Throwable {
        ExponentialRetryPolicy retryPolicy = createExponentialRetryPolicy(retryAnnotation);

        WorkflowClock clock = new DecisionContextProviderImpl().getDecisionContext().getWorkflowClock();
        AsyncExecutor executor = new AsyncRetryingExecutor(retryPolicy, clock);

        Settable<?> result;
        if (isVoidReturnType(pjp)) {
            result = null;
        }
        else {
            result = new Settable<Object>();
        }
        DecoratorInvocationHandler handler = new DecoratorInvocationHandler(pjp, result);
        executor.execute(handler);
        return result;
    }
View Full Code Here

Examples of com.amazonaws.services.simpleworkflow.flow.interceptors.AsyncExecutor

    @Around("execution(@com.amazonaws.services.simpleworkflow.flow.annotations.ExponentialRetry * *(..)) && @annotation(retryAnnotation)")
    public Object retry(final ProceedingJoinPoint pjp, ExponentialRetry retryAnnotation) throws Throwable {
        ExponentialRetryPolicy retryPolicy = createExponentialRetryPolicy(retryAnnotation);

        WorkflowClock clock = new DecisionContextProviderImpl().getDecisionContext().getWorkflowClock();
        AsyncExecutor executor = new AsyncRetryingExecutor(retryPolicy, clock);

        Settable<?> result;
        if (isVoidReturnType(pjp)) {
            result = null;
        }
        else {
            result = new Settable<Object>();
        }
        DecoratorInvocationHandler handler = new DecoratorInvocationHandler(pjp, result);
        executor.execute(handler);
        return result;
    }
View Full Code Here

Examples of com.badlogic.gdx.utils.async.AsyncExecutor

    setLoader(PolygonRegion.class, new PolygonRegionLoader(resolver));
    setLoader(I18NBundle.class, new I18NBundleLoader(resolver));
    setLoader(Model.class, ".g3dj", new G3dModelLoader(new JsonReader(), resolver));
    setLoader(Model.class, ".g3db", new G3dModelLoader(new UBJsonReader(), resolver));
    setLoader(Model.class, ".obj", new ObjLoader(resolver));
    executor = new AsyncExecutor(1);
  }
View Full Code Here

Examples of com.sun.enterprise.web.connector.grizzly.AsyncExecutor

     */
    protected synchronized void resume(SelectionKey key) {
        Iterator<AsyncProcessorTask> iterator = asyncTasks.iterator();

        AsyncProcessorTask apt = null;
        AsyncExecutor asyncE = null;
        ProcessorTask pt = null;
        while (iterator.hasNext()){
            apt = iterator.next();
            asyncE = apt.getAsyncExecutor();
            if (asyncE == null){
View Full Code Here

Examples of com.sun.enterprise.web.connector.grizzly.AsyncExecutor

     * Create an instance of <code>DefaultAsyncExecutor</code>
     */   
    private AsyncExecutor newAsyncExecutor(AsyncTask asyncTask){
       
        Class className = null;
        AsyncExecutor asyncExecutor = null;
        try{                             
            className = Class.forName(asyncExecutorClassName);
            asyncExecutor = (AsyncExecutor)className.newInstance();
        } catch (ClassNotFoundException ex){
            throw new RuntimeException(ex);
        } catch (InstantiationException ex){
            throw new RuntimeException(ex);
        } catch (IllegalAccessException ex){
            throw new RuntimeException(ex);
        }
       
        if ( asyncExecutor != null ){
            asyncExecutor.setAsyncTask(asyncTask);
            asyncExecutor.setAsyncHandler(this);
           
            for (AsyncFilter l : asyncFilters){
                asyncExecutor.addAsyncFilter(l);
            }
        }
        return asyncExecutor;
    }
View Full Code Here

Examples of org.activiti.engine.impl.asyncexecutor.AsyncExecutor

    }
  }

  public void waitForJobExecutorToProcessAllJobs(long maxMillisToWait, long intervalMillis) {
    JobExecutor jobExecutor = null;
    AsyncExecutor asyncExecutor = null;
    if (processEngineConfiguration.isAsyncExecutorEnabled() == false) {
      jobExecutor = processEngineConfiguration.getJobExecutor();
      jobExecutor.start();
     
    } else {
      asyncExecutor = processEngineConfiguration.getAsyncExecutor();
      asyncExecutor.start();
    }

    try {
      Timer timer = new Timer();
      InteruptTask task = new InteruptTask(Thread.currentThread());
      timer.schedule(task, maxMillisToWait);
      boolean areJobsAvailable = true;
      try {
        while (areJobsAvailable && !task.isTimeLimitExceeded()) {
          Thread.sleep(intervalMillis);
          areJobsAvailable = areJobsAvailable();
        }
      } catch (InterruptedException e) {
      } finally {
        timer.cancel();
      }
      if (areJobsAvailable) {
        throw new ActivitiException("time limit of " + maxMillisToWait + " was exceeded");
      }

    } finally {
      if (processEngineConfiguration.isAsyncExecutorEnabled() == false) {
        jobExecutor.shutdown();
      } else {
        asyncExecutor.shutdown();
      }
    }
  }
View Full Code Here

Examples of org.activiti.engine.impl.asyncexecutor.AsyncExecutor

    }
  }

  public void waitForJobExecutorOnCondition(long maxMillisToWait, long intervalMillis, Callable<Boolean> condition) {
    JobExecutor jobExecutor = null;
    AsyncExecutor asyncExecutor = null;
    if (processEngineConfiguration.isAsyncExecutorEnabled() == false) {
      jobExecutor = processEngineConfiguration.getJobExecutor();
      jobExecutor.start();
     
    } else {
      asyncExecutor = processEngineConfiguration.getAsyncExecutor();
      asyncExecutor.start();
    }

    try {
      Timer timer = new Timer();
      InteruptTask task = new InteruptTask(Thread.currentThread());
      timer.schedule(task, maxMillisToWait);
      boolean conditionIsViolated = true;
      try {
        while (conditionIsViolated) {
          Thread.sleep(intervalMillis);
          conditionIsViolated = !condition.call();
        }
      } catch (InterruptedException e) {
      } catch (Exception e) {
        throw new ActivitiException("Exception while waiting on condition: "+e.getMessage(), e);
      } finally {
        timer.cancel();
      }
      if (conditionIsViolated) {
        throw new ActivitiException("time limit of " + maxMillisToWait + " was exceeded");
      }

    } finally {
      if (processEngineConfiguration.isAsyncExecutorEnabled() == false) {
        jobExecutor.shutdown();
      } else {
        asyncExecutor.shutdown();
      }
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.