Coverage Report - org.mule.module.launcher.AppDeployerMonitorThreadFactory
 
Classes in this File Line Coverage Branch Coverage Complexity
AppDeployerMonitorThreadFactory
0%
0/11
0%
0/2
1
 
 1  
 /*
 2  
  * $Id: AppDeployerMonitorThreadFactory.java 20088 2010-11-05 16:51:41Z aperepel $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.module.launcher;
 12  
 
 13  
 import java.util.concurrent.ThreadFactory;
 14  
 import java.util.concurrent.atomic.AtomicInteger;
 15  
 
 16  
 public class AppDeployerMonitorThreadFactory implements ThreadFactory
 17  
 {
 18  
 
 19  0
     static final AtomicInteger poolNumber = new AtomicInteger(1);
 20  
     final ThreadGroup group;
 21  0
     final AtomicInteger threadNumber = new AtomicInteger(1);
 22  
     final String namePrefix;
 23  
 
 24  
     public AppDeployerMonitorThreadFactory()
 25  0
     {
 26  0
         SecurityManager s = System.getSecurityManager();
 27  0
         group = (s != null) ? s.getThreadGroup() :
 28  
                 Thread.currentThread().getThreadGroup();
 29  0
         namePrefix = String.format("app-deployer-monitor-%d-thread-",  poolNumber.getAndIncrement());
 30  0
     }
 31  
 
 32  
     public Thread newThread(Runnable r)
 33  
     {
 34  0
         Thread t = new Thread(group, r,
 35  
                               namePrefix + threadNumber.getAndIncrement(),
 36  
                               0);
 37  
         // make sure it's non-daemon, allows for an 'idle' state of Mule by preventing early termination
 38  0
         t.setDaemon(false);
 39  0
         t.setPriority(Thread.MIN_PRIORITY);
 40  0
         return t;
 41  
     }
 42  
 
 43  
 
 44  
 }