camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Johan Haleby <johan.hal...@gmail.com>
Subject Re: Close Mina socket after each message
Date Tue, 09 Feb 2010 09:24:01 GMT

I found one way to do this by setting the "CamelMinaCloseSessionWhenComplete"
header to true in my route. How ever I would like the route to be as
decoupled as possible from the actual endpoint component. Is there anyway to
configure the "CamelMinaCloseSessionWhenComplete" in the session using the
endpoint URI only?

/Johan


Johan Haleby wrote:
> 
> Hi,
> 
> I'm using Camel 2.1 with an Apache Mina endpoint configured like: 
> inbound.endpoint=mina:tcp://localhost:6204?sync=false&textline=false
> 
> When many messages are sent to this endpoint I get the following
> exception:
> org.apache.mina.common.RuntimeIOException: Failed to get the session.
>    at
> org.apache.mina.common.support.DefaultConnectFuture.getSession(DefaultConnectFuture.java:63)
>    at
> org.apache.camel.component.mina.MinaProducer.openConnection(MinaProducer.java:175)
>    at
> org.apache.camel.component.mina.MinaProducer.process(MinaProducer.java:73)
>    at
> org.apache.camel.processor.MulticastProcessor.doProcess(MulticastProcessor.java:241)
>    at
> org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:206)
>    at
> org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:132)
>    at
> org.apache.camel.processor.RecipientList.sendToRecipientList(RecipientList.java:87)
>    at
> org.apache.camel.processor.RecipientList.process(RecipientList.java:71)
>    at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
>    at
> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
>    at
> org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
>    at
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
>    at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
>    at
> org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:223)
>    at
> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:153)
>    at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:91)
>    at
> org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
>    at
> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
>    at org.apache.camel.processor.Pipeline.process(Pipeline.java:74)
>    at
> org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
>    at
> org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
>    at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
>    at
> org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:85)
>    at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>    at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>    at java.lang.Thread.run(Thread.java:619)
> Caused by: java.net.SocketException: Too many open files
>    at sun.nio.ch.Net.socket0(Native Method)
>    at sun.nio.ch.Net.socket(Net.java:94)
>    at sun.nio.ch.SocketChannelImpl.<init>(SocketChannelImpl.java:84)
>    at
> sun.nio.ch.SelectorProviderImpl.openSocketChannel(SelectorProviderImpl.java:37)
>    at java.nio.channels.SocketChannel.open(SocketChannel.java:105)
>    at
> org.apache.mina.transport.socket.nio.SocketConnector.connect(SocketConnector.java:168)
>    at
> org.apache.mina.transport.socket.nio.SocketConnector.connect(SocketConnector.java:137)
>    at
> org.apache.camel.component.mina.MinaProducer.openConnection(MinaProducer.java:173)
>    ... 24 more
> 
> I understand that this may happen because of too many open descriptors (in
> my system it's 1024) but I would like to configure Mina to automatically
> disconnect the socket when a message has been received. I never expect a
> reply to these kinds of messages so what I'm looking for is kind of a
> "fire and forget" approach. I thought setting the sync flag to false would
> actually do this but I'm not sure anymore because I don't think I should
> get this exception if that was the case. Any suggestions?
> 
> /Johan
> 

-- 
View this message in context: http://old.nabble.com/Close-Mina-socket-after-each-message-tp27512082p27512471.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message