@Override
    public Thread newThread( Runnable runnable )
    {
        final String name = threadNamePrefix + threadNumber.incrementAndGet();

        final Thread thread;
        if ( delegate != null )
        {
            thread = delegate.newThread( runnable );
            thread.setName( name );
        }
        else
        {
            if ( stackSize != null )
            {
                thread = new Thread( threadGroup, runnable, name, stackSize );
            }
            else
            {
                thread = new Thread( threadGroup, runnable, name );
            }
        }

        if ( daemon != null && thread.isDaemon() != daemon )
        {
            thread.setDaemon( daemon );
        }

        if ( priority != null && thread.getPriority() != priority )
        {
            thread.setPriority( priority );
        }

        return thread;
    }
Constructs a thread factory that will create new Thread instances (as opposed to using a delegate thread
factory).

When null is provided for the optional arguments of this method, default values as provided by the Thread class
implementation will be used.

@param threadNamePrefix The prefix of the name for new threads (cannot be null or an empty string).
@param daemon the isDaemon value for new threads (null to use default value).
@param priority override for the priority value for new threads (null to use default value).
@param threadGroup override for the thread group (null to use default value).
@param stackSize override for the stackSize value for new threads (null to use default value).
xmppserver/src/main/java/org/jivesoftware/util/NamedThreadFactory.java