File tree Expand file tree Collapse file tree 3 files changed +17
-3
lines changed
plugins/hypervisors/simulator/src/com/cloud/resource Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Original file line number Diff line number Diff line change 2525import java .util .LinkedList ;
2626import java .util .List ;
2727import java .util .Map ;
28+ import java .util .concurrent .atomic .AtomicReference ;
2829
2930import javax .inject .Inject ;
3031import javax .naming .ConfigurationException ;
3132
33+ import org .apache .cloudstack .managed .context .ManagedContextRunnable ;
3234import org .apache .log4j .Logger ;
3335
3436import com .cloud .agent .IAgentControl ;
@@ -244,7 +246,19 @@ protected String findScript(String script) {
244246 }
245247
246248 @ Override
247- public Answer executeRequest (Command cmd ) {
249+ public final Answer executeRequest (final Command cmd ) {
250+ final AtomicReference <Answer > result = new AtomicReference <Answer >();
251+ new ManagedContextRunnable () {
252+ @ Override
253+ protected void runInContext () {
254+ result .set (executeRequestInContext (cmd ));
255+ }
256+ }.run ();
257+
258+ return result .get ();
259+ }
260+
261+ public Answer executeRequestInContext (Command cmd ) {
248262 return null ;
249263 }
250264
Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ public AgentRoutingResource() {
7777 }
7878
7979 @ Override
80- public Answer executeRequest (Command cmd ) {
80+ public Answer executeRequestInContext (Command cmd ) {
8181 try {
8282 if (cmd instanceof StartCommand ) {
8383 return execute ((StartCommand )cmd );
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ public AgentStorageResource() {
5454 }
5555
5656 @ Override
57- public Answer executeRequest (Command cmd ) {
57+ public Answer executeRequestInContext (Command cmd ) {
5858 if (cmd instanceof ReadyCommand ) {
5959 return new ReadyAnswer ((ReadyCommand )cmd );
6060 } else {
You can’t perform that action at this time.
0 commit comments