Hi there,

I'm having an issue with a protocol handler i wrote. The handler acquires a 
lock in the first stages of the protocol communication, then multiple messages 
are exchanged between client and server and when the client decides to put an 
end to the communication server should release the acquired lock. The problem 
is multiple threads are used to service the protocol and the thread that 
releases the lock isn't the one that acquired the lock which results in an 
IllegalStateMonitorException. 

How can i configure Mina to use a thread pool but to always use the same thread 
in a session as this will prevent the lock problem ?

Here's the code i actually use to configure mina :

---
        ByteBuffer.setUseDirectBuffers(false);
        ByteBuffer.setAllocator(new SimpleByteBufferAllocator());
        
        IoAcceptor acceptor = new SocketAcceptor(Runtime.getRuntime()
                .availableProcessors() + 1, Executors.newCachedThreadPool());
        IoAcceptorConfig config = new SocketAcceptorConfig();
        ((SocketAcceptorConfig) config).setReuseAddress(true);
        DefaultIoFilterChainBuilder chain = config.getFilterChain();
        
        chain.addLast("codec", new ProtocolCodecFilter(
                new TextLineCodecFactory(Charset.forName("UTF-8"))));

        acceptor.bind(new InetSocketAddress(PORT), new 
Pop3ProtocolHandler(true),
                config);
---


Regards,
Edouard De Oliveira


 



      
___________________________________________________________________________ 
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Profitez des connaissances, des opinions et des expériences des internautes sur 
Yahoo! Questions/Réponses 
http://fr.answers.yahoo.com

Reply via email to