[logback-dev] ContextBase.java's executorService to be instantiated by newSingleThreadExecutor

ming qin mingqin at live.com
Sun Apr 14 02:33:32 CEST 2013


Hi:
  Looking at ContextBase.java in master branch,  in line 65, executorService is instantiated by 
ThreadPoolExecutor(int corePoolSize,
                          int maximumPoolSize,
                          long keepAliveTime,
                          TimeUnit unit,
                          BlockingQueue<Runnable> workQueue)Would it be simple to replace this line 42 and line 45 with 
ExecutorService executorService = Executors.newSingleThreadExecutor();

I tested above codes successfully with scan_LOGBACK_474( ) in ReconfigureOnChangeTest.java with Jdk 1.7_06 , 

 // CORE_POOL_SIZE must be 1 for JDK 1.5. For JD 1.6 or higher it's set to 0
 // so that there are no idle threads
  private static final int CORE_POOL_SIZE = EnvUtil.isJDK5() ? 1 : 0;

// 0 (JDK 1,6+) or 1 (JDK 1.5) idle threads, 2 maximum threads, no idle waiting
  ExecutorService executorService = new ThreadPoolExecutor(CORE_POOL_SIZE, 2,
          0L, TimeUnit.MILLISECONDS,
          new LinkedBlockingQueue<Runnable>());



Ming Qin

Cell Phone Number: 949-388-9898

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-dev/attachments/20130413/30d3c7f3/attachment.html>


More information about the logback-dev mailing list