1 23 24 28 29 package com.sun.enterprise.config.serverbeans; 30 31 import org.w3c.dom.*; 32 import org.netbeans.modules.schema2beans.*; 33 import java.beans.*; 34 import java.util.*; 35 import java.io.Serializable ; 36 import com.sun.enterprise.config.ConfigBean; 37 import com.sun.enterprise.config.ConfigException; 38 import com.sun.enterprise.config.StaleWriteConfigException; 39 import com.sun.enterprise.util.i18n.StringManager; 40 41 43 public class ThreadPool extends ConfigBean implements Serializable 44 { 45 46 static Vector comparators = new Vector(); 47 private static final org.netbeans.modules.schema2beans.Version runtimeVersion = new org.netbeans.modules.schema2beans.Version(4, 2, 0); 48 49 50 public ThreadPool() { 51 this(Common.USE_DEFAULT_VALUES); 52 } 53 54 public ThreadPool(int options) 55 { 56 super(comparators, runtimeVersion); 57 initPropertyTables(0); 59 this.initialize(options); 60 } 61 62 void initialize(int options) { 64 65 } 66 67 71 public String getThreadPoolId() { 72 return getAttributeValue(ServerTags.THREAD_POOL_ID); 73 } 74 79 public void setThreadPoolId(String v, boolean overwrite) throws StaleWriteConfigException { 80 setAttributeValue(ServerTags.THREAD_POOL_ID, v, overwrite); 81 } 82 86 public void setThreadPoolId(String v) { 87 setAttributeValue(ServerTags.THREAD_POOL_ID, v); 88 } 89 93 public String getMinThreadPoolSize() { 94 return getAttributeValue(ServerTags.MIN_THREAD_POOL_SIZE); 95 } 96 101 public void setMinThreadPoolSize(String v, boolean overwrite) throws StaleWriteConfigException { 102 setAttributeValue(ServerTags.MIN_THREAD_POOL_SIZE, v, overwrite); 103 } 104 108 public void setMinThreadPoolSize(String v) { 109 setAttributeValue(ServerTags.MIN_THREAD_POOL_SIZE, v); 110 } 111 114 public static String getDefaultMinThreadPoolSize() { 115 return "0".trim(); 116 } 117 121 public String getMaxThreadPoolSize() { 122 return getAttributeValue(ServerTags.MAX_THREAD_POOL_SIZE); 123 } 124 129 public void setMaxThreadPoolSize(String v, boolean overwrite) throws StaleWriteConfigException { 130 setAttributeValue(ServerTags.MAX_THREAD_POOL_SIZE, v, overwrite); 131 } 132 136 public void setMaxThreadPoolSize(String v) { 137 setAttributeValue(ServerTags.MAX_THREAD_POOL_SIZE, v); 138 } 139 142 public static String getDefaultMaxThreadPoolSize() { 143 return "200".trim(); 144 } 145 149 public String getIdleThreadTimeoutInSeconds() { 150 return getAttributeValue(ServerTags.IDLE_THREAD_TIMEOUT_IN_SECONDS); 151 } 152 157 public void setIdleThreadTimeoutInSeconds(String v, boolean overwrite) throws StaleWriteConfigException { 158 setAttributeValue(ServerTags.IDLE_THREAD_TIMEOUT_IN_SECONDS, v, overwrite); 159 } 160 164 public void setIdleThreadTimeoutInSeconds(String v) { 165 setAttributeValue(ServerTags.IDLE_THREAD_TIMEOUT_IN_SECONDS, v); 166 } 167 170 public static String getDefaultIdleThreadTimeoutInSeconds() { 171 return "120".trim(); 172 } 173 177 public String getNumWorkQueues() { 178 return getAttributeValue(ServerTags.NUM_WORK_QUEUES); 179 } 180 185 public void setNumWorkQueues(String v, boolean overwrite) throws StaleWriteConfigException { 186 setAttributeValue(ServerTags.NUM_WORK_QUEUES, v, overwrite); 187 } 188 192 public void setNumWorkQueues(String v) { 193 setAttributeValue(ServerTags.NUM_WORK_QUEUES, v); 194 } 195 198 public static String getDefaultNumWorkQueues() { 199 return "1".trim(); 200 } 201 206 protected String getRelativeXPath() { 207 String ret = null; 208 ret = "thread-pool" + (canHaveSiblings() ? "[@thread-pool-id='" + getAttributeValue("thread-pool-id") +"']" : "") ; 209 return (null != ret ? ret.trim() : null); 210 } 211 212 215 public static String getDefaultAttributeValue(String attr) { 216 if(attr == null) return null; 217 attr = attr.trim(); 218 if(attr.equals(ServerTags.MIN_THREAD_POOL_SIZE)) return "0".trim(); 219 if(attr.equals(ServerTags.MAX_THREAD_POOL_SIZE)) return "200".trim(); 220 if(attr.equals(ServerTags.IDLE_THREAD_TIMEOUT_IN_SECONDS)) return "120".trim(); 221 if(attr.equals(ServerTags.NUM_WORK_QUEUES)) return "1".trim(); 222 return null; 223 } 224 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 226 comparators.add(c); 227 } 228 229 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 231 comparators.remove(c); 232 } 233 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 234 } 235 236 public void dump(StringBuffer str, String indent){ 238 String s; 239 Object o; 240 org.netbeans.modules.schema2beans.BaseBean n; 241 } 242 public String dumpBeanNode(){ 243 StringBuffer str = new StringBuffer (); 244 str.append("ThreadPool\n"); this.dump(str, "\n "); return str.toString(); 247 }} 248 249 251 | Popular Tags |