Skip to content

Commit 5f53dce

Browse files
committed
CLOUDSTACK-6363: [Automation] jetty server is going OOM for simulator
1 parent a3bfda1 commit 5f53dce

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

plugins/hypervisors/simulator/src/com/cloud/resource/AgentResourceBase.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@
2525
import java.util.LinkedList;
2626
import java.util.List;
2727
import java.util.Map;
28+
import java.util.concurrent.atomic.AtomicReference;
2829

2930
import javax.inject.Inject;
3031
import javax.naming.ConfigurationException;
3132

33+
import org.apache.cloudstack.managed.context.ManagedContextRunnable;
3234
import org.apache.log4j.Logger;
3335

3436
import 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

plugins/hypervisors/simulator/src/com/cloud/resource/AgentRoutingResource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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);

plugins/hypervisors/simulator/src/com/cloud/resource/AgentStorageResource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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 {

0 commit comments

Comments
 (0)