org.bdware.doip.cluster.callback.ForkCallBack Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of doip-audit-tool Show documentation
Show all versions of doip-audit-tool Show documentation
doip audit tool developed by bdware
The newest version!
package org.bdware.doip.cluster.callback;
import org.bdware.doip.cluster.client.DoaClusterClient;
import org.bdware.doip.cluster.client.TraceableDoaClusterClient;
import org.bdware.doip.codec.doipMessage.DoipMessage;
import java.util.Map;
public class ForkCallBack extends CookieJSResultCallback {
private DoipMessage msg;
private DDOClusterDoipInvocationCallback ddoClusterDoipInvocationCallback;
private String[] doidList;
private DoaClusterClient doaClusterClient;
public ForkCallBack(Map cookie, DoaClusterClient doaClusterClient, DoipMessage msg, String[] doIdList, DDOClusterDoipInvocationCallback ddoClusterDoipMessageCallback) {
super(cookie);
this.msg = msg;
this.ddoClusterDoipInvocationCallback = ddoClusterDoipMessageCallback;
this.doidList = doIdList;
this.doaClusterClient = doaClusterClient;
}
@Override
public void onResult(DoipMessage[] result) {
//正常发送并join fork之后的消息
assert doidList.length == result.length;
for (int i = 0; i < doidList.length; i++) {
String doid = doidList[i];
DoipMessage toCallDoipMessage;
if (doaClusterClient instanceof TraceableDoaClusterClient) {
toCallDoipMessage = ((TraceableDoaClusterClient) doaClusterClient).wrapSpanWithParent(result[i], msg, "Fork");
} else {
toCallDoipMessage = result[i];
}
DOIPInvocationCallback doipInvocationCallback = new DOIPInvocationCallback(doid, toCallDoipMessage, this.ddoClusterDoipInvocationCallback);
this.doaClusterClient.sendMessage(doid, toCallDoipMessage, doipInvocationCallback, false);
}
}
}