Example usage for org.springframework.core.task SimpleAsyncTaskExecutor submit

List of usage examples for org.springframework.core.task SimpleAsyncTaskExecutor submit

Introduction

In this page you can find the example usage for org.springframework.core.task SimpleAsyncTaskExecutor submit.

Prototype

@Override
    public <T> Future<T> submit(Callable<T> task) 

Source Link

Usage

From source file:com.qpark.eip.core.spring.lockedoperation.AbstractAsyncLockableOperation.java

/**
 * Invoke the real logic of the {@link LockableOperation}.
 *
 * @param context//  w ww. j a  v  a  2s.c o m
 *            the {@link LockableOperationContext} (could be
 *            <code>null</code>) to pass to the {@link LockableOperation}.
 */
@Override
protected final void invokeOperation(final LockableOperationContext context) {
    this.getLogger().debug("Create AsyncRunner for the operation {} ({})",
            new Object[] { this.getName(), this.getUUID() });
    AutowireCapableBeanFactory beanFactory = this.applicationContext.getAutowireCapableBeanFactory();
    AsyncLockableOperationRunner operationRunner = beanFactory.createBean(AsyncLockableOperationRunner.class);
    beanFactory.initializeBean(operationRunner,
            new StringBuffer(this.getName()).append(System.currentTimeMillis()).toString());

    operationRunner.setOperation(this);
    operationRunner.setContext(context);

    SimpleAsyncTaskExecutor executor = new SimpleAsyncTaskExecutor(
            new StringBuffer("exec").append(this.getName()).toString());
    executor.submit(operationRunner);
    this.getLogger().debug("AsyncRunner of operation {} ({}) started with SimpleAsyncTaskExecutor",
            new Object[] { this.getName(), this.getUUID() });
}