Package org.springframework.core.task

Examples of org.springframework.core.task.TaskExecutor


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


            container.setReceiveTimeout(config.getReceiveTimeout());
        }
        if (config.getRecoveryInterval() >= 0) {
            container.setRecoveryInterval(config.getRecoveryInterval());
        }
        TaskExecutor taskExecutor = config.getTaskExecutor();
        if (taskExecutor != null) {
            container.setTaskExecutor(taskExecutor);
        }
        PlatformTransactionManager tm = config.getTransactionManager();
        if (tm != null) {
View Full Code Here

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

        eventCollector.setDefaultInterval(500);
        eventCollector.getFilters().add(new StringContentFilter());
        eventCollector.getHandlers().add(new ContentLengthHandler());
        eventCollector.setEventsPerMessageCall(2);
        eventCollector.setQueue(queue);
        TaskExecutor executor = new SyncTaskExecutor();
        eventCollector.setExecutor(executor);
        MockService monitoringService = new MockService();
        eventCollector.setMonitoringServiceClient(monitoringService);

        // Add events
View Full Code Here

  }

  @Test
  public void sendWithExecutor() throws Exception {
    BeforeHandleInterceptor interceptor = new BeforeHandleInterceptor();
    TaskExecutor executor = mock(TaskExecutor.class);
    ExecutorSubscribableChannel testChannel = new ExecutorSubscribableChannel(executor);
    testChannel.addInterceptor(interceptor);
    testChannel.subscribe(this.handler);
    testChannel.send(this.message);
    verify(executor).execute(this.runnableCaptor.capture());
View Full Code Here

    final TestMessageListener listener = new TestMessageListener();

    this.container.setConnectionFactory(connectionFactory);
    this.container.setDestinationName(DESTINATION_NAME);
    this.container.setMessageListener(listener);
    this.container.setTaskExecutor(new TaskExecutor() {
      @Override
      public void execute(Runnable task) {
        listener.executorInvoked = true;
        assertFalse(listener.listenerInvoked);
        task.run();
View Full Code Here

  }

  @Test
  public void testTaskExecutor() throws Exception {
    final List<String> list = new ArrayList<String>();
    jobLauncher.setTaskExecutor(new TaskExecutor() {
      @Override
      public void execute(Runnable task) {
        list.add("execute");
        task.run();
      }
View Full Code Here

  @Test
  public void testTaskExecutorRejects() throws Exception {

    final List<String> list = new ArrayList<String>();
    jobLauncher.setTaskExecutor(new TaskExecutor() {
      @Override
      public void execute(Runnable task) {
        list.add("execute");
        throw new TaskRejectedException("Planned failure");
      }
View Full Code Here

  }

  @Test
  public void testTaskExecutorFailure() throws Exception {
    handler.setGridSize(2);
    handler.setTaskExecutor(new TaskExecutor() {
      @Override
      public void execute(Runnable task) {
        if (count > 0) {
          throw new TaskRejectedException("foo");
        }
View Full Code Here

  @Before
  public void setUp() {

    template = new TaskExecutorRepeatTemplate();
    TaskExecutor taskExecutor = new SimpleAsyncTaskExecutor();
    threadPool.setMaxPoolSize(300);
    threadPool.setCorePoolSize(10);
    threadPool.setQueueCapacity(0);
    threadPool.afterPropertiesSet();
    taskExecutor = threadPool;
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.