Hi,
I used the servicemix 3.3.2 with the component servicemix-http-2011.01, in
the ConsumerProcessor.java, .
in method 1 process(HttpServletRequest request, HttpServletResponse
response), it handle the http request. first it will send this request to
exchange. and then suspend this cont.
synchronized (cont) {
*channel.send(exchange);*
if (!isSTFlow) {
if (log.isDebugEnabled()) {
log.debug("Suspending continuation for exchange:
" + exchange.getExchangeId());
}
*boolean result = cont.suspend(suspentionTime);*
exchange =
exchanges.remove(exchange.getExchangeId());
request.removeAttribute(MessageExchange.class.getName());
if (!result) {
locks.remove(exchange.getExchangeId());
throw new Exception("Exchange timed out");
}
} else {
String id = (String)
request.getAttribute(MessageExchange.class.getName());
locks.remove(id);
exchange = exchanges.remove(id);
request.removeAttribute(MessageExchange.class.getName());
}
}
when the exchange returns, it will call another process(MessageExchange
exchange) method 2:
if (!cont.isPending()) {
* isSTFlow = true;*
} else {
isSTFlow = false;
synchronized (cont) {
if (locks.remove(exchange.getExchangeId()) == null) {
throw new Exception("HTTP request has timed out");
}
if (log.isDebugEnabled()) {
log.debug("Resuming continuation for exchange: " +
exchange.getExchangeId());
}
exchanges.put(exchange.getExchangeId(), exchange);
cont.resume();
if (!cont.isResumed()) {
if (log.isDebugEnabled()) {
log.debug("Could not resume continuation for
exchange: " + exchange.getExchangeId());
}
exchanges.remove(exchange.getExchangeId());
throw new Exception("HTTP request has timed out for
exchange: " + exchange.getExchangeId());
}
}
}
It will set the flag isSTFlow = true if the cont is not pending.
So below case will be one abnormal case:
method 1 send the message to exchange. before it set the cont to pending,
the exchange return to method 2. then in method 2, it will found that the
cont is not pending, it will set the flag isSTFlow = true. then after this,
this flag will be always true. Then below Exception will be throw:
java.lang.IllegalStateException: component is not owner when trying to set
error: java.lang.IllegalStateException: component is not owner
.at
org.apache.servicemix.jbi.messaging.MessageExchangeImpl.setError(MessageExchangeImpl.java:264)
.at
org.apache.servicemix.http.processors.ConsumerProcessor.process(ConsumerProcessor.java:239)
.at
org.apache.servicemix.http.HttpBridgeServlet.service(HttpBridgeServlet.java:56)
.at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
.at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
.at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
.at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
.at
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
.at
org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
.at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
.at org.mortbay.jetty.Server.handle(Server.java:326)
.at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
.at
org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:938)
.at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
.at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
.at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
.at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
.at
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: java.lang.IllegalStateException: component is not owner
.at
org.apache.servicemix.jbi.messaging.MessageExchangeImpl.setStatus(MessageExchangeImpl.java:251)
.at
org.apache.servicemix.http.processors.ConsumerProcessor.process(ConsumerProcessor.java:236)
.... 16 more
How to solve this problem? Thanks.
Regards.
Leng Yong.
--
View this message in context:
http://servicemix.396122.n5.nabble.com/servicemix-http-BC-multiple-thread-problem-tp5096519p5096519.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.