java中entry_Java FastMap.Entry方法代码示例

import javolution.util.FastMap; //导入方法依赖的package包/类

protected void processXmlCAPDialog(XmlCAPDialog xmlCAPDialog, CAPDialog capDialog, boolean isScf, FastList sentInvokeIds)

throws CAPException {

// marking of incoming Invokes for which there will not be responses / errors

FastList processInvokeWithoutAnswerIds = xmlCAPDialog.getProcessInvokeWithoutAnswerIds();

for (FastList.Node n = processInvokeWithoutAnswerIds.head(), end = processInvokeWithoutAnswerIds.tail(); (n = n

.getNext()) != end;) {

capDialog.processInvokeWithoutAnswer(n.getValue());

}

int addedMsgs = 0;

Boolean prearrangedEnd = xmlCAPDialog.getPrearrangedEnd();

// sending of errors

FastMap errorMessages = xmlCAPDialog.getErrorComponents().getErrorComponents();

for (FastMap.Entry n = errorMessages.head(), end = errorMessages.tail(); (n = n.getNext()) != end;) {

Long invokeId = n.getKey();

CAPErrorMessage capError = n.getValue();

capDialog.sendErrorComponent(invokeId, capError);

addedMsgs++;

}

// sending of Invokes / RRL

FastList capMessages = xmlCAPDialog.getCAPMessages();

for (FastList.Node n = capMessages.head(), end = capMessages.tail(); (n = n.getNext()) != end;) {

camelStatAggregator.updateMessagesSent();

camelStatAggregator.updateMessagesAll();

CAPMessage capMessage = n.getValue();

if (addedMsgs > 0) {

// we need to test if we have enough free space to send a component in the same massage

int encodedSize;

if (prearrangedEnd != null) {

encodedSize = capDialog.getMessageUserDataLengthOnClose(prearrangedEnd);

} else {

encodedSize = capDialog.getMessageUserDataLengthOnSend();

}

CAPAsnPrimitive asnPrimitive = (CAPAsnPrimitive) capMessage;

AsnOutputStream asnOs = new AsnOutputStream();

int nextMessageSize = 10; // 10 = max component encoding header size

try {

asnPrimitive.encodeAll(asnOs);

nextMessageSize += asnOs.size(); // 10 = max component encoding header size

} catch (CAPException e) {

// ignore it: this means that a message does not have a parameter body

}

if (encodedSize + nextMessageSize + 5 > capDialog.getMaxUserDataLength()) {

capDialog.send();

addedMsgs = 0;

}

}

ProcessComponentResult ps = this.processCAPMessageFromApplication(capMessage, capDialog, isScf);

if (ps.componentAdded)

addedMsgs++;

if (ps.invokeId != null && sentInvokeIds != null) {

sentInvokeIds.add(ps.invokeId);

}

}// for loop

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值