Hi
I am using mina 1.1.3 for communications between an applet and a server
process, using DemuxingProtocolCodecFactory and a DemuxingIoHandler my
implementation is based on the GraphicalCharGen example.
The Problem: Applet Not Destroying cleanly
>From reading the forum it would appear that the Executor is not destroying
it threads but since I rely on the in built functionally I do not have a set
of Executors to clean up. Is that my problem?  Should I have my own
Executors?

Many Thanks in Advance

Paul

The applet on destroy produces the following trace output.
DEBUG [AnonymousIoService-5] org.apache.mina.filter.executor.ExecutorFilter
- Exiting since queue is empty for /172.18.1.15:8082
Stop Applet
Destroy Applet
 INFO [thread applet-com.bae.nads.gui.NADSApplet.class]
com.bae.nads.tcp.client.NadControlClient - [/172.18.1.15:8082] CLOSE
DEBUG [SocketConnectorIoProcessor-0.0]
org.apache.mina.filter.executor.ExecutorFilter - Launching thread for
/172.18.1.15:8082
Applet Destroyed 
 INFO [AnonymousIoService-6] com.bae.nads.tcp.client.NadControlClient -
[/172.18.1.15:8082] CLOSED
DEBUG [AnonymousIoService-6] com.bae.nads.tcp.client.NadControlClient -
[/172.18.1.15:8082] Session Closed
DEBUG [AnonymousIoService-6] org.apache.mina.filter.executor.ExecutorFilter
- Exiting since queue is empty for /172.18.1.15:8082
Exception in thread "AnonymousIoService-1"
java.lang.IllegalMonitorStateException
        at java.util.concurrent.locks.ReentrantLock$Sync.tryRelease(Unknown 
Source)
        at java.util.concurrent.locks.AbstractQueuedSynchronizer.release(Unknown
Source)
        at java.util.concurrent.locks.ReentrantLock.unlock(Unknown Source)
        at java.util.concurrent.LinkedBlockingQueue.take(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
And so on upto 20 repeatations  of the same AnonymousIoService-n.

The socket creation code 
public NadControlClient(String host, int port,NadsMessageListener
messageListener) {
                this.host = host;
                this.port = port;
                this.messageListener = messageListener;
                connector = new SocketConnector();
                // Change the worker timeout to 1 second to make the I/O thread 
quit soon
                // when there's no connection to manage.
                connector.setWorkerTimeout(1);
                // Configure the service.

                cfg = new SocketConnectorConfig();
                cfg.setConnectTimeout(CONNECT_TIMEOUT);

                cfg.getFilterChain().addLast("codec",
                                new ProtocolCodecFilter(new 
NadsProtocolCodecFactory(false)));

                cfg.getFilterChain().addLast("logger", new LoggingFilter());

                this.addMessageHandler(SummaryMessage.class, new 
SummaryMessageHandler(
                                this.messageListener));
                this.addMessageHandler(AckMessage.class, new AckMessageHandler(
                                this.messageListener));
                this.addMessageHandler(AlarmsMessage.class, new 
AlarmsMessageHandler(
                                this.messageListener));

        }

Socket Connection and Disconnection  code snippets
public boolean connect() {
                boolean result = false;
                ConnectFuture connectFuture = connector.connect(new 
InetSocketAddress(
                                host, port), this, cfg);
                connectFuture.join(CONNECT_TIMEOUT);
                try {
                        session = connectFuture.getSession();
                        if (session != null)
                                result = session.isConnected();
                } catch (RuntimeIOException e) {
                        result = false;
                }
                return result;
        }

        public void disconnect() {
                connector.setWorkerTimeout(0);

                if (session != null) {
                        CloseFuture future = session.close();
                        // Wait until the connection is closed
                        future.join();
                        session = null;
                }

        }

-- 
View this message in context: 
http://www.nabble.com/Applet-not-destroying-cleanly-tf4855371s16868.html#a13893939
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.

Reply via email to