Claus, thanks again. I was not able to get much clues by using mina user
forum. My debugging tells me that, apache mina endpoint is not using
separate connections for each exchange. As a result, when I sent messages in
parallel to the same host:port, the same connections is used to send all the
requests. While the legacy server is processing and waiting to post a
response, the connection is receiving more requests, which is causing the
legacy server to forcibly close the connection.

Is there any option in apache camel mina that forces the MinaProducer to use
a new connection for each exchange?

Also, do you think if there is any benefit performance wise by using mina
tcp client over plain java socket clients?


Claus Ibsen-2 wrote:
> 
> On Mon, Sep 14, 2009 at 5:51 AM, jamhit <[email protected]>
> wrote:
>>
>> Thanks Claus.  I am not sure, if the issue is due to remote host forcibly
>> closing connection. My simple java socket client works fine by sending
>> multiple concurrent transactions to the same legacy server. I have a
>> feeling
>> it is something in my mina configuration or codec setting. Does mina
>> reuse
>> connections for multiple messages? The legacy system is expecting
>> separate
>> connections per request.
>> I am using an extension of CumulativeProtocolDecoder. Do I need to do
>> something in dispose() method to forcibly close the connection or
>> session?
> 
> I think you should ask at Apache Mina about this.
> 
>>
>> Also, will you please post the link to the camel 2.0 trunk with
>> concurrency
>> unit test?
>>
>>
>>
>> Claus Ibsen-2 wrote:
>>>
>>> On Sun, Sep 13, 2009 at 6:38 AM, jamhit <[email protected]>
>>> wrote:
>>>>
>>>> I am getting errors when trying to send more than one message to a
>>>> legacy
>>>> tcp/ip service using a Apache camel mina endpoint. Everything works as
>>>> expected when requests are send one at a time.  Using camel 1.6.  Any
>>>> clues
>>>> will be appreciated. Following is the error I am getting.
>>>>
>>>> Caused by: java.io.IOException: An existing connection was forcibly
>>>> closed
>>>> by the remote host
>>>
>>> Looks like the remote server forbids multiple connections from same IP
>>> (client).
>>>
>>> There is a concurrency unit test in the unit tests for camel 2.x
>>> (trunk).
>>> So locally with mina itself it can handle multiple connections.
>>>
>>>>        at sun.nio.ch.SocketDispatcher.read0(Native Method)
>>>>        at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:25)
>>>>        at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:233)
>>>>        at sun.nio.ch.IOUtil.read(IOUtil.java:200)
>>>>        at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:236)
>>>>        at
>>>> org.apache.mina.transport.socket.nio.SocketIoProcessor.read(SocketIoProcessor.java:218)
>>>>        at
>>>> org.apache.mina.transport.socket.nio.SocketIoProcessor.process(SocketIoProcessor.java:198)
>>>>        at
>>>> org.apache.mina.transport.socket.nio.SocketIoProcessor.access$400(SocketIoProcessor.java:45)
>>>>        at
>>>> org.apache.mina.transport.socket.nio.SocketIoProcessor$Worker.run(SocketIoProcessor.java:485)
>>>>        at
>>>> org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/Apache-camel-mina-concurrency-issue-tp25420520p25420520.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Apache-camel-mina-concurrency-issue-tp25420520p25429960.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Apache-camel-mina-concurrency-issue-tp25420520p25463057.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to