1 28 29 package com.caucho.server.resin; 30 31 import com.caucho.util.L10N; 32 import com.caucho.util.ThreadPool; 33 34 import javax.annotation.PostConstruct; 35 36 public class ThreadPoolConfig { 37 private static final L10N L = new L10N(ThreadPoolConfig.class); 38 39 private static final int THREAD_GAP = 5; 40 41 private int _threadMax = 256; 42 private int _threadSpareMin = 5; 43 44 public void setThreadMax(int threadMax) 45 { 46 _threadMax = threadMax; 47 } 48 49 52 public void setSpareThreadMin(int threadSpareMin) 53 { 54 _threadSpareMin = threadSpareMin; 55 } 56 57 @PostConstruct 58 public void init() 59 { 60 ThreadPool threadPool = ThreadPool.getThreadPool(); 61 62 threadPool.setThreadMax(_threadMax); 63 threadPool.setThreadIdleMax(_threadSpareMin + THREAD_GAP); 64 threadPool.setThreadIdleMin(_threadSpareMin); 65 } 66 } 67 | Popular Tags |