Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
2.10.0
-
None
-
Unknown
Description
I've been trying to write a service using Camel 2.10.0 which uses the mina2 component to expose a service, and which uses SSL, using an endpoint of:
mina2:tcp://localhost:6500?sync=true&filters=#hl7SslFilterFactory,#hl7CodecFilter&allowDefaultCodec=false
however, what I found was that the SSL handshake was failing quite often for no apparent reason. Investigating further, it appeared that messages sent during the handshake were being processed out of order - specifically, when the client (which uses a standard java SSLSocket) sent a "TLSv1 Change Cipher Spec" followed by a "TLSv1 Handshake", the "TLSv1 Handshake" was being processed before the "TLSv1 Change Cipher Spec", breaking the process.
This appears to have been caused because when the the Mina2Consumer configures MINA for tcp (in Mina2Consumer.setupSocketProtocol), it is using a UnorderedThreadPoolExecutor - which allows messages to be processed in any order. Switching this to use a OrderedThreadPoolExecutor instead has fixed the issue.
May I request that the use of UnorderedThreadPoolExecutor vs OrderedThreadPoolExecutor be configurable via endpoint parameters? (or OrderedThreadPoolExecutor is used when SSL if configured). I'm assuming the reason for the use of UnorderedThreadPoolExecutor is simply for performance.