Skip to content

Commit 2bbdc0c

Browse files
committed
agent: synchronize sendRequest wait
Signed-off-by: Abhishek Kumar <[email protected]>
1 parent eab0531 commit 2bbdc0c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

agent/src/main/java/com/cloud/agent/Agent.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,10 +1050,12 @@ public AgentControlAnswer sendRequest(final AgentControlCommand cmd, final int t
10501050
registerControlListener(listener);
10511051
try {
10521052
postRequest(request);
1053-
try {
1054-
listener.wait(timeoutInMilliseconds);
1055-
} catch (final InterruptedException e) {
1056-
logger.warn("sendRequest is interrupted, exit waiting");
1053+
synchronized (listener) {
1054+
try {
1055+
listener.wait(timeoutInMilliseconds);
1056+
} catch (final InterruptedException e) {
1057+
logger.warn("sendRequest is interrupted, exit waiting");
1058+
}
10571059
}
10581060
return listener.getAnswer();
10591061
} finally {

0 commit comments

Comments
 (0)