]> git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.security.core/src/org/argeo/security/core/AsyncSystemTaskExecutor.java
Use standard JAAS login context for RAP login
[lgpl/argeo-commons.git] / org.argeo.security.core / src / org / argeo / security / core / AsyncSystemTaskExecutor.java
1 /*
2 * Copyright (C) 2007-2012 Argeo GmbH
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.argeo.security.core;
17
18 import org.argeo.security.SystemExecutionService;
19 import org.springframework.core.task.SimpleAsyncTaskExecutor;
20
21 /**
22 * Asynchronous Spring TaskExecutor (for use in JMS for example) wrapping a
23 * {@link SystemExecutionService}.
24 */
25 public class AsyncSystemTaskExecutor extends SimpleAsyncTaskExecutor {
26 private static final long serialVersionUID = -8035527542087963068L;
27
28 private SystemExecutionService systemExecutionService;
29
30 public AsyncSystemTaskExecutor() {
31 super();
32 }
33
34 public AsyncSystemTaskExecutor(String threadNamePrefix) {
35 super(threadNamePrefix);
36 }
37
38 @Override
39 public Thread createThread(final Runnable runnable) {
40 Runnable systemExecutionRunnable = new Runnable() {
41
42 public void run() {
43 systemExecutionService.execute(runnable);
44
45 }
46 };
47 return super.createThread(systemExecutionRunnable);
48 }
49
50 public void setSystemExecutionService(
51 SystemExecutionService systemExecutionService) {
52 this.systemExecutionService = systemExecutionService;
53 }
54
55 }