[ 
https://issues.apache.org/jira/browse/DIRMINA-1015?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Emmanuel Lecharny resolved DIRMINA-1015.
----------------------------------------
    Resolution: Not A Problem

We can pass an executor to the {{Service}} constructor, so it's easy to have it 
creating daemon threads, like with :

{code:java}
Executor executor = Executors.newCachedThreadPool(new ThreadFactory() {
                @Override
                public Thread newThread(Runnable r) {
                    // Create daemon threads.
                    Thread t = Executors.defaultThreadFactory().newThread(r);
                    t.setDaemon(true);
                    return t;
                }
            });

IoAcceptor acceptor = new NioSocketAcceptor(executor, NioProcessor.class);
...
{code}

> AbstractIoService creates unnamed non-daemon threads
> ----------------------------------------------------
>
>                 Key: DIRMINA-1015
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-1015
>             Project: MINA
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 2.0.9
>            Reporter: Matt Kusnierz
>            Priority: Minor
>
> The org.apache.mina.core.service.AbstractIoService can create an executor in 
> its constructor. This executor is creating simply using the 
> java.util.concurrent.Executors.newCachedThreadPool() factory method. But this 
> create threads with unhelpful "thread-x-pool-y" names, and more importantly 
> creates non-daemon threads. The daemon thread aspect can lead to applications 
> not properly terminating. When no executor is supplied as a constructor 
> argument, the default should be to create a newCachedThreadPool, but to 
> supply a ThreadFactory that a) creates "mina-xxx" named threads, and b) 
> creates daemon threads.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to