JournalIO non-daemon thread for disposer

51 views
Skip to first unread message

Rob Shepherd

unread,
Nov 25, 2014, 7:10:21 AM11/25/14
to jour...@googlegroups.com
Dear JournalIO users,

I have a situation where my application has crashed (nothing to do with JournalIO) but the JVM does not exit.

The only non-daemon Thread is the journalIO disposer thread.

Is there a reason why it cannot be a daemon thread?


I patched the JournalIO's ThreadFactory to provide daemon threads and my program exited normally when the main thread finished/died

( - well you get the idea, not "normally" but actually finished after a main thread exception)

Is this good/bad practise? 

thanks

Rob

Rob Shepherd

unread,
Nov 25, 2014, 7:11:27 AM11/25/14
to jour...@googlegroups.com
private static class JournalThreadFactory implements ThreadFactory 
{
        private final String groupName;
        private final String threadName;

        public JournalThreadFactory(String groupName, String threadName) {
            this.groupName = groupName;
            this.threadName = threadName;
        }

        @Override
        public Thread newThread(Runnable r) {
            Thread newThread = new Thread(new ThreadGroup(groupName), r, threadName);
                newThread.setDaemon(true); // <-- patched to setDaemon
                return newThread;
        }
}


Reply all
Reply to author
Forward
0 new messages