make ConnectHostMsg in queue
@@ -658,9 +658,11 @@ public abstract class HostBase extends AbstractHost {
self.getUuid(), reply.getError()));
}
bus.reply(msg, r);
- finish(chain);
}
});
+
+ // no need to block the queue, because the ConnectHostMsg will be queued as well
+ finish(chain);
}
@Override
@@ -803,6 +805,14 @@ public abstract class HostBase extends AbstractHost {
}
private void connectHost(final ConnectHostMsg msg, final NoErrorCompletion completion) {
+ thdf.chainSubmit(new ChainTask(msg, completion) {
+ @Override
+ public String getSyncSignature() {
+ return String.format("connect-host-%s", self.getUuid());
+ }
+
+ @Override
+ public void run(SyncTaskChain chain) {
checkState();
final ConnectHostReply reply = new ConnectHostReply();
@@ -871,7 +881,6 @@ public abstract class HostBase extends AbstractHost {
});
bus.reply(msg, reply);
- completion.done();
}
});
@@ -884,6 +893,13 @@ public abstract class HostBase extends AbstractHost {
reply.setError(errCode);
bus.reply(msg, reply);
+ }
+ });
+
+ Finally(new FlowFinallyHandler(completion, msg) {
+ @Override
+ public void Finally() {
+ chain.next();
completion.done();
}
});
@@ -891,6 +907,15 @@ public abstract class HostBase extends AbstractHost {
}).start();
}
+ @Override
+ public String getName() {
+ return "connect-host";
+ }
+ });
+
+
+ }
+
private void changeStateByLocalMessage(final ChangeHostStateMsg msg, final NoErrorCompletion completion) {
thdf.chainSubmit(new ChainTask(msg, completion) {
@Override
