diff --git a/client/tomcatconf/applicationContext.xml.in b/client/tomcatconf/applicationContext.xml.in
index 9eda42636c4..5d2fb2cc1cf 100644
--- a/client/tomcatconf/applicationContext.xml.in
+++ b/client/tomcatconf/applicationContext.xml.in
@@ -168,8 +168,6 @@
-
-
@@ -311,8 +309,6 @@
-
-
@@ -662,7 +658,6 @@
-
@@ -695,7 +690,6 @@
-
@@ -792,6 +786,16 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/server/src/com/cloud/api/ApiAsyncJobDispatcher.java b/server/src/com/cloud/api/ApiAsyncJobDispatcher.java
new file mode 100644
index 00000000000..98ed5bf4f88
--- /dev/null
+++ b/server/src/com/cloud/api/ApiAsyncJobDispatcher.java
@@ -0,0 +1,121 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you 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.
+package com.cloud.api;
+
+import java.lang.reflect.Type;
+import java.util.Map;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.ExceptionResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.async.AsyncJobDispatcher;
+import com.cloud.async.AsyncJobManager;
+import com.cloud.async.AsyncJobResult;
+import com.cloud.async.AsyncJobVO;
+import com.cloud.async.SyncQueueManager;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+import com.cloud.user.dao.AccountDao;
+import com.cloud.utils.component.AdapterBase;
+import com.cloud.utils.component.ComponentContext;
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+
+public class ApiAsyncJobDispatcher extends AdapterBase implements AsyncJobDispatcher {
+ private static final Logger s_logger = Logger.getLogger(ApiAsyncJobDispatcher.class);
+
+ @Inject private ApiDispatcher _dispatcher;
+
+ @Inject private AsyncJobManager _asyncJobMgr;
+ @Inject private SyncQueueManager _queueMgr;
+ @Inject private AccountDao _accountDao;
+
+ public ApiAsyncJobDispatcher() {
+ }
+
+ @Override
+ public void RunJob(AsyncJobVO job) {
+ BaseAsyncCmd cmdObj = null;
+ try {
+ Class> cmdClass = Class.forName(job.getCmd());
+ cmdObj = (BaseAsyncCmd)cmdClass.newInstance();
+ cmdObj = ComponentContext.inject(cmdObj);
+ cmdObj.configure();
+ cmdObj.setJob(job);
+
+ Type mapType = new TypeToken