All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bdware.doip.cluster.callback.ForkCallBack Maven / Gradle / Ivy

There is a newer version: 1.5.4
Show newest version
package org.bdware.doip.cluster.callback;

import org.bdware.doip.cluster.client.DoaClusterClient;
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 message = result[i];
            DOIPInvocationCallback doipInvocationCallback = new DOIPInvocationCallback(doid, message, this.ddoClusterDoipInvocationCallback);
            this.doaClusterClient.sendMessage(doid, message, doipInvocationCallback, false);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy