org.bdware.doip.cluster.entity.SendMsgReqPack 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
package org.bdware.doip.cluster.entity;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.bdware.doip.cluster.client.DoaClusterClient;
import org.bdware.doip.codec.doipMessage.DoipMessage;
import org.bdware.doip.endpoint.client.DoipMessageCallback;
public class SendMsgReqPack extends RequestPackIntf {
static Logger LOGGER = LogManager.getLogger(SendMsgReqPack.class);
private final long createTime;
DOEntity doEntity;
DoipMessage doipMessage;
DoipMessageCallback doipMessageCallback;
boolean needFlowControl;
DoaClusterClient doaClusterClient;
public SendMsgReqPack(DoaClusterClient doaClusterClient, DOEntity cachedDO, DoipMessage message, DoipMessageCallback callback, boolean needFlowControl) {
this.doaClusterClient = doaClusterClient;
this.doEntity = cachedDO;
this.doipMessage = message;
this.doipMessageCallback = callback;
this.needFlowControl = needFlowControl;
this.createTime = System.currentTimeMillis();
}
public void setDoipMessage(DoipMessage message) {
this.doipMessage = message;
}
public DOEntity getDoEntity() {
return doEntity;
}
public DoipMessage getDoipMessage() {
return doipMessage;
}
public DoipMessageCallback getDoipMessageCallback() {
return doipMessageCallback;
}
public boolean needFlowControl() {
return needFlowControl;
}
@Override
public long getPriority() {
return createTime + doEntity.getType().ordinal() * 100;
}
@Override
public void run() {
doEntity.sendMessage(doaClusterClient, doipMessage, doipMessageCallback, doaClusterClient.getRouterConfig());
}
}