Package org.springframework.core.task

Examples of org.springframework.core.task.TaskExecutor


    private static Object contextLock = new Object();
   
    public void start() {
        synchronized (contextLock) {
            if (ctx == null) {
                TaskExecutor taskExecutor = new SimpleAsyncTaskExecutor("HelloJmsDemo");
                taskExecutor.execute(this);
            }
        }
    }
View Full Code Here


        String clientId = endpoint.getClientId();
        if (clientId != null) {
            clientId += ".CamelReplyManager";
            answer.setClientId(clientId);
        }
        TaskExecutor taskExecutor = endpoint.getTaskExecutor();
        if (taskExecutor != null) {
            answer.setTaskExecutor(taskExecutor);
        }
        ExceptionListener exceptionListener = endpoint.getExceptionListener();
        if (exceptionListener != null) {
View Full Code Here

    }

    public static void generateXpdlImage(final String designerwebBaseUrl, final String processDefId, boolean asynchronous) {
        String profile = DynamicDataSourceManager.getCurrentProfile();
       
        TaskExecutor executor = (TaskExecutor) WorkflowUtil.getApplicationContext().getBean("xpdlImageExecutor");
        executor.execute(new XpdlImageTask(profile, designerwebBaseUrl, processDefId));
    }
View Full Code Here

      }
    };

    // executor used for creating the appCtx
    // chosen based on the sync/async configuration
    TaskExecutor executor = null;

    ApplicationContextConfiguration config = new ApplicationContextConfiguration(bundle);

    String creationType;

    // synch/asynch context creation
    if (config.isCreateAsynchronously()) {
      // for the async stuff use the executor
      executor = taskExecutor;
      creationType = "Asynchronous";
    }
    else {
      // for the sync stuff, use this thread
      executor = sameThreadTaskExecutor;
      creationType = "Synchronous";
    }

    if (debug) {
      log.debug(creationType + " context creation for bundle " + bundleString);
    }

    // wait/no wait for dependencies behaviour
    if (config.isWaitForDependencies()) {
      DependencyWaiterApplicationContextExecutor appCtxExecutor = new DependencyWaiterApplicationContextExecutor(
        localApplicationContext, !config.isCreateAsynchronously(),
        extenderConfiguration.getDependencyFactories());

      long timeout;
      // check whether a timeout has been defined

      if (ConfigUtils.isDirectiveDefined(bundle.getHeaders(), ConfigUtils.DIRECTIVE_TIMEOUT)) {
        timeout = config.getTimeout();
        if (debug)
          log.debug("Setting bundle-defined, wait-for-dependencies timeout value=" + timeout
              + " ms, for bundle " + bundleString);

      }
      else {
        timeout = extenderConfiguration.getDependencyWaitTime();
        if (debug)
          log.debug("Setting globally defined wait-for-dependencies timeout value=" + timeout
              + " ms, for bundle " + bundleString);
      }

      appCtxExecutor.setTimeout(config.getTimeout());

      appCtxExecutor.setWatchdog(timer);
      appCtxExecutor.setTaskExecutor(executor);
      appCtxExecutor.setMonitoringCounter(contextsStarted);
      // set events publisher
      appCtxExecutor.setDelegatedMulticaster(this.multicaster);

      contextsStarted.increment();
    }
    else {
      // do nothing; by default contexts do not wait for services.
    }

    executor.execute(contextRefresh);
  }
View Full Code Here

  public void testTaskExecutor() throws Exception {
    assertTrue(config.getTaskExecutor() instanceof SimpleAsyncTaskExecutor);
  }

  public void testShutdownTaskExecutor() throws Exception {
    TaskExecutor executor = config.getShutdownTaskExecutor();
    assertTrue(executor instanceof TimerTaskExecutor);
  }
View Full Code Here

    assertTrue(config.getTaskExecutor() instanceof SimpleAsyncTaskExecutor);
    assertEquals("conf-extender-thread", ((SimpleAsyncTaskExecutor) config.getTaskExecutor()).getThreadNamePrefix());
  }

  public void testShutdownTaskExecutor() throws Exception {
    TaskExecutor executor = config.getShutdownTaskExecutor();
    assertTrue(executor instanceof SimpleAsyncTaskExecutor);
  }
View Full Code Here

TOP

Related Classes of org.springframework.core.task.TaskExecutor

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.