}
}
private void fixProtocolThreadFactories(TP tp, ThreadDecoratorImpl threadDecorator)
{
ThreadFactory stackFactory = tp.getThreadFactory();
if (stackFactory == null)
{
stackFactory = new DefaultThreadFactory(Util.getGlobalThreadGroup(), "", false);
tp.setThreadFactory(stackFactory);
}
fixThreadManager(stackFactory, threadDecorator, "TP.getThreadFactory()");
log.debug("Fixed thread factory for " + tp);
ThreadFactory timerFactory = tp.getTimerThreadFactory();
if (timerFactory == null)
{
timerFactory = new LazyThreadFactory(Util.getGlobalThreadGroup(), "Timer", true, true);
tp.setTimerThreadFactory(timerFactory);
}
fixThreadManager(timerFactory, threadDecorator, "TP.getTimerThreadFactory()");
log.debug("Fixed timer thread factory for " + tp);
ThreadGroup pool_thread_group = null;
if (tp.isDefaulThreadPoolEnabled())
{
ThreadFactory defaultPoolFactory = tp.getDefaultThreadPoolThreadFactory();
if (defaultPoolFactory == null)
{
pool_thread_group=new ThreadGroup(Util.getGlobalThreadGroup(), "Thread Pools");
defaultPoolFactory = new DefaultThreadFactory(pool_thread_group, "Incoming", false, true);
tp.setThreadFactory(defaultPoolFactory);
}
fixThreadManager(defaultPoolFactory, threadDecorator, "TP.getDefaultThreadPoolThreadFactory()");
log.debug("Fixed default pool thread factory for " + tp);
}
if (tp.isOOBThreadPoolEnabled())
{
ThreadFactory oobPoolFactory = tp.getOOBThreadPoolThreadFactory();
if (oobPoolFactory == null)
{
if (pool_thread_group == null)
pool_thread_group=new ThreadGroup(Util.getGlobalThreadGroup(), "Thread Pools");
oobPoolFactory = new DefaultThreadFactory(pool_thread_group, "OOB", false, true);
tp.setThreadFactory(oobPoolFactory);
}
fixThreadManager(oobPoolFactory, threadDecorator, "TP.getOOBThreadPoolThreadFactory()");
log.debug("Fixed oob pool thread factory for " + tp);
}
Map<ThreadFactory, Protocol> factories= new HashMap<ThreadFactory, Protocol>();
Protocol tmp=tp.getUpProtocol();
while(tmp != null) {
ThreadFactory f=tmp.getThreadFactory();
if(f != null && !factories.containsKey(f))
{
factories.put(f, tmp);
}
tmp=tmp.getUpProtocol();