本文整理汇总了Java中javolution.util.FastList.head方法的典型用法代码示例。如果您正苦于以下问题:Java FastList.head方法的具体用法?Java FastList.head怎么用?Java FastList.head使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javolution.util.FastList
的用法示例。
在下文中一共展示了FastList.head方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doPost
import javolution.util.FastList; //导入方法依赖的package包/类
@Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
ServletInputStream is = request.getInputStream();
try {
XmlCAPDialog original = factory.deserialize(is);
HttpSession session = request.getSession(true);
if (logger.isInfoEnabled()) {
logger.info("doPost. HttpSession=" + session.getId() + " Dialog = " + original);
}
FastList<CAPMessage> capMessages = original.getCAPMessages();
for (FastList.Node<CAPMessage> n = capMessages.head(), end = capMessages.tail(); (n = n.getNext()) != end;) {
CAPMessage capMessage = n.getValue();
switch (capMessage.getMessageType()) {
case initialDP_Request:
InitialDPRequestImpl initialDPRequest = (InitialDPRequestImpl) capMessage;
this.handleIdp(original, initialDPRequest);
break;
case applyChargingReport_Request:
ApplyChargingReportRequestImpl applyChargingReportRequest = (ApplyChargingReportRequestImpl) capMessage;
logger.info(String.format("Received applyChargingReportRequest=%s", applyChargingReportRequest));
break;
case eventReportBCSM_Request:
EventReportBCSMRequestImpl eventReportBCSMRequest = (EventReportBCSMRequestImpl) capMessage;
logger.info(String.format("Received eventReportBCSMRequest=%s", eventReportBCSMRequest));
break;
default:
logger.info(String.format("unrecognized capMessage=%s", capMessage));
break;
}
}
// send response
this.sendResponse(response, original);
} catch (XMLStreamException e) {
logger.error("Error while processing received XML", e);
}
}
示例2: doPost
import javolution.util.FastList; //导入方法依赖的package包/类
@Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
ServletInputStream is = request.getInputStream();
try {
XmlCAPDialog original = factory.deserialize(is);
HttpSession session = request.getSession(true);
if (logger.isInfoEnabled()) {
logger.info("doPost. HttpSession=" + session.getId() + " Dialog = " + original);
}
FastList<CAPMessage> capMessages = original.getCAPMessages();
for (FastList.Node<CAPMessage> n = capMessages.head(), end = capMessages.tail(); (n = n.getNext()) != end;) {
CAPMessage capMessage = n.getValue();
switch (capMessage.getMessageType()) {
// case initialDP_Request:
// InitialDPRequestImpl initialDPRequest = (InitialDPRequestImpl) capMessage;
// this.handleIdp(original, initialDPRequest);
// break;
// case continue_Request:
// ContinueRequestImpl continueRequest = (ContinueRequestImpl) capMessage;
// this.handleContinueRequest(original, continueRequest);
// break;
case applyChargingReport_Request:
ApplyChargingReportRequestImpl applyChargingReportRequest = (ApplyChargingReportRequestImpl) capMessage;
logger.info(String.format("Received applyChargingReportRequest=%s", applyChargingReportRequest));
break;
case eventReportBCSM_Request:
EventReportBCSMRequestImpl eventReportBCSMRequest = (EventReportBCSMRequestImpl) capMessage;
logger.info(String.format("Received eventReportBCSMRequest=%s", eventReportBCSMRequest));
break;
default:
logger.info(String.format("unrecognized capMessage=%s", capMessage));
break;
}
}
// send response
this.sendResponse(response, original);
} catch (XMLStreamException e) {
logger.error("Error while processing received XML", e);
}
}
示例3: processXmlCAPDialog
import javolution.util.FastList; //导入方法依赖的package包/类
protected void processXmlCAPDialog(XmlCAPDialog xmlCAPDialog, CAPDialog capDialog, boolean isScf, FastList<Long> sentInvokeIds)
throws CAPException {
// marking of incoming Invokes for which there will not be responses / errors
FastList<Long> processInvokeWithoutAnswerIds = xmlCAPDialog.getProcessInvokeWithoutAnswerIds();
for (FastList.Node<Long> 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<Long, CAPErrorMessage> errorMessages = xmlCAPDialog.getErrorComponents().getErrorComponents();
for (FastMap.Entry<Long, CAPErrorMessage> 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<CAPMessage> capMessages = xmlCAPDialog.getCAPMessages();
for (FastList.Node<CAPMessage> 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
}
示例4: start
import javolution.util.FastList; //导入方法依赖的package包/类
public void start() throws Exception {
// for monitoring thread use, it's preferable to create your own
// instance of an executor and cast it to a ThreadPoolExecutor from
// Executors.newCachedThreadPool() this permits exposing thinks like
// executor.getActiveCount() via JMX possible no point renaming the
// threads in a factory since underlying Netty framework does not easily
// allow you to customize your thread names
this.executor = (ThreadPoolExecutor) Executors.newCachedThreadPool();
// to enable automatic expiration of requests, a second scheduled
// executor is required which is what a monitor task will be executed
// with - this is probably a thread pool that can be shared with between
// all client bootstraps
this.monitorExecutor = (ScheduledThreadPoolExecutor) Executors.newScheduledThreadPool(1, new ThreadFactory() {
private AtomicInteger sequence = new AtomicInteger(0);
@Override
public Thread newThread(Runnable r) {
Thread t = new Thread(r);
t.setName("SmppServer-SessionWindowMonitorPool-" + sequence.getAndIncrement());
return t;
}
});
// a single instance of a client bootstrap can technically be shared
// between any sessions that are created (a session can go to any
// different number of SMSCs) - each session created under a client
// bootstrap will use the executor and monitorExecutor set in its
// constructor - just be *very* careful with the "expectedSessions"
// value to make sure it matches the actual number of total concurrent
// open sessions you plan on handling - the underlying netty library
// used for NIO sockets essentially uses this value as the max number of
// threads it will ever use, despite the "max pool size", etc. set on
// the executor passed in here
// Setting expected session to be 25. May be this should be
// configurable?
this.clientBootstrap = new DefaultSmppClient(this.executor, 25, monitorExecutor);
this.smppClientOpsThread = new SmppClientOpsThread(this.clientBootstrap, this.smppSessionHandlerInterface, this.esmeManagement);
(new Thread(this.smppClientOpsThread)).start();
FastList<Esme> esmes = this.esmeManagement.esmes;
for (FastList.Node<Esme> n = esmes.head(), end = esmes.tail(); (n = n.getNext()) != end;) {
Esme esme = n.getValue();
if (esme.getSmppSessionType() == SmppSession.Type.CLIENT) {
this.startSmppClientSession(esme);
}
}
}