View Javadoc

1   /*
2   Copyright 2010 James Pether Sörling Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 
3   	$Id
4   */
5   
6   package com.hack23.cia.service.impl.admin;
7   
8   import org.springframework.core.task.TaskExecutor;
9   
10  /***
11   * The Class TaskServiceImpl.
12   */
13  public class TaskServiceImpl implements TaskService {
14  
15      /*** The task execution. */
16      private final Runnable taskExecution;
17  
18      /*** The task executor. */
19      private final TaskExecutor taskExecutor;
20  
21      /***
22       * Instantiates a new task service impl.
23       *
24       * @param taskExecutor the task executor
25       * @param taskExecution the task execution
26       */
27      public TaskServiceImpl(final TaskExecutor taskExecutor,
28              final Runnable taskExecution) {
29          super();
30          this.taskExecutor = taskExecutor;
31          this.taskExecution = taskExecution;
32      }
33  
34      /*
35       * (non-Javadoc)
36       * 
37       * @see com.hack23.cia.service.TaskService#execute()
38       */
39      @Override
40  	public final void execute() {
41          taskExecutor.execute(taskExecution);
42      }
43  
44  }