Spring Framework SimpleAsyncTaskExecutor - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework SimpleAsyncTaskExecutor class.

This code example shows how to use the following methods:
 
	@Test
	public void taskExecutor() throws Exception {
 
		URI uri = new URI("ws://example.com/abc");
		this.wsClient.setTaskExecutor(new SimpleAsyncTaskExecutor());
		WebSocketSession session = this.wsClient.doHandshake(this.wsHandler, this.headers, uri).get();
 
		assertNotNull(session);
	} 
 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setThreadNamePrefix
 */ 
public class ExecutorChannelTests { 
 
	@Test
	public void verifyDifferentThread() throws Exception {
		SimpleAsyncTaskExecutor taskExecutor = new SimpleAsyncTaskExecutor();
		taskExecutor.setThreadNamePrefix("test-");
		ExecutorChannel channel = new ExecutorChannel(taskExecutor);
		CountDownLatch latch = new CountDownLatch(1);
		TestHandler handler = new TestHandler(latch);
		channel.subscribe(handler);
		channel.send(new GenericMessage<String>("test"));
		latch.await(1000, TimeUnit.MILLISECONDS);
		assertEquals(0, latch.getCount());
		assertNotNull(handler.thread);
		assertFalse(Thread.currentThread().equals(handler.thread));
		assertEquals("test-1", handler.thread.getName());
	} 
 
	@Test
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
public class BufferedSimpleAsyncHttpRequestFactoryTests extends AbstractAsyncHttpRequestFactoryTestCase { 
 
	@Override 
	protected AsyncClientHttpRequestFactory createRequestFactory() {
		SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
		AsyncListenableTaskExecutor taskExecutor = new SimpleAsyncTaskExecutor();
		requestFactory.setTaskExecutor(taskExecutor);
		return requestFactory;
	} 
 
	@Override 
	@Test
	public void httpMethods() throws Exception {
		try { 
			assertHttpMethod("patch", HttpMethod.PATCH);
		} 
		catch (ProtocolException ex) {
			// Currently HttpURLConnection does not support HTTP PATCH 
		} 
	} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:sleep
		container = new RedisMessageListenerContainer();
		container.setConnectionFactory(template.getConnectionFactory());
		container.setBeanName("container");
		container.addMessageListener(adapter, Arrays.asList(new ChannelTopic(CHANNEL)));
		container.setTaskExecutor(new SyncTaskExecutor());
		container.setSubscriptionExecutor(new SimpleAsyncTaskExecutor());
		container.afterPropertiesSet();
		container.start();
 
		Thread.sleep(1000);
	} 
 
	@After 
	public void tearDown() throws Exception {
		container.destroy();
	} 
 
	@SuppressWarnings("rawtypes") 
	public PubSubTests(ObjectFactory<T> factory, RedisTemplate template) {
		this.factory = factory;
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 
import org.slf4j.Logger; 
import org.slf4j.LoggerFactory; 
import org.springframework.core.task.SimpleAsyncTaskExecutor;
 
public class FakeAsyncExecutor extends SimpleAsyncTaskExecutor {
    private final static Logger                   log            = LoggerFactory.getLogger(FakeAsyncExecutor.class); 
    private final        ThreadLocal<Callable<?>> callableHolder = new ThreadLocal<Callable<?>>();
 
    public Callable<?> getCallable() {
        return callableHolder.get();
    } 
 
    public <T> Future<T> submit(Callable<T> task) {
        FutureTask<T> future = (FutureTask<T>) super.submit(task);
        callableHolder.set(task);
        return future;
    } 
 
    @Override 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
		tasklet.setSystemProcessExitCodeMapper(new TestExitCodeMapper());
		tasklet.setTimeout(5000); // long enough timeout
		tasklet.setTerminationCheckInterval(500);
		tasklet.setCommand("invalid command, change value for successful execution");
		tasklet.setInterruptOnCancel(true);
		tasklet.setTaskExecutor(new SimpleAsyncTaskExecutor());
		tasklet.afterPropertiesSet();
 
		tasklet.beforeStep(stepExecution);
	} 
 
	/* 
	 * Regular usage scenario - successful execution of system command. 
	 */ 
	@Test
	public void testExecute() throws Exception {
		String command = "java -version";
		tasklet.setCommand(command);
		tasklet.afterPropertiesSet();
 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
This code example shows how to use the following methods:
  } 
 
  @Bean 
  @ConditionalOnMissingBean 
  public TaskExecutor taskExecutor() {
    return new SimpleAsyncTaskExecutor();
  } 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
    @Override 
    public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
        // TODO Auto-generated method stub 
 
 
        configurer.setTaskExecutor(new  SimpleAsyncTaskExecutor());
        super.configureAsyncSupport(configurer);
    } 
 
    // 
    //    @Override 
    //    @Bean 
    //    public RequestMappingHandlerAdapter 
    //                  requestMappingHandlerAdapter() { 
    // 
    //        RequestMappingHandlerAdapter requestMappingHandlerAdapter = super.requestMappingHandlerAdapter(); 
    // 
    //        requestMappingHandlerAdapter.setAsyncRequestTimeout(timeout) 
    // 
    //        requestMappingHandlerAdapter.get 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
			return this.value; 
		} 
	} 
 
	@SuppressWarnings("serial") 
	private static class SyncTaskExecutor extends SimpleAsyncTaskExecutor { 
 
		@Override 
		public void execute(Runnable task, long startTimeout) { 
			task.run(); 
		} 
	} 
 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Spring Framework SimpleAsyncTaskExecutor Methods: