]> git.argeo.org Git - lgpl/argeo-commons.git/blob - security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/core/AsyncSystemTaskExecutor.java
Improve system execution
[lgpl/argeo-commons.git] / security / runtime / org.argeo.security.core / src / main / java / org / argeo / security / core / AsyncSystemTaskExecutor.java
1 package org.argeo.security.core;
2
3 import org.argeo.security.SystemExecutionService;
4 import org.springframework.core.task.SimpleAsyncTaskExecutor;
5
6 /**
7 * Asynchronous Spring TaskExecutor (for use in JMS for example) wrapping a
8 * {@link SystemExecutionService}.
9 */
10 public class AsyncSystemTaskExecutor extends SimpleAsyncTaskExecutor {
11 private static final long serialVersionUID = -8035527542087963068L;
12
13 private SystemExecutionService systemExecutionService;
14
15 public AsyncSystemTaskExecutor() {
16 super();
17 }
18
19 public AsyncSystemTaskExecutor(String threadNamePrefix) {
20 super(threadNamePrefix);
21 }
22
23 @Override
24 public Thread createThread(final Runnable runnable) {
25 Runnable systemExecutionRunnable = new Runnable() {
26
27 public void run() {
28 systemExecutionService.execute(runnable);
29
30 }
31 };
32 return super.createThread(systemExecutionRunnable);
33 }
34
35 public void setSystemExecutionService(
36 SystemExecutionService systemExecutionService) {
37 this.systemExecutionService = systemExecutionService;
38 }
39
40 }