148 149 private static int getDefaultThreadPoolInitialSize() { 150 String propValue = AccessController.doPrivileged(new 151 GetPropertyAction(DEFAULT_THREAD_POOL_INITIAL_SIZE)); 152 if (propValue != null) { 153 try { 154 return Integer.parseInt(propValue); 155 } catch (NumberFormatException x) { 156 throw new Error("Value of property '" + DEFAULT_THREAD_POOL_INITIAL_SIZE + 157 "' is invalid: " + x); 158 } 159 } 160 return -1; 161 } 162 163 private static ThreadFactory getDefaultThreadPoolThreadFactory() { 164 String propValue = AccessController.doPrivileged(new 165 GetPropertyAction(DEFAULT_THREAD_POOL_THREAD_FACTORY)); 166 if (propValue != null) { 167 try { 168 Class<?> c = Class 169 .forName(propValue, true, ClassLoader.getSystemClassLoader()); 170 return ((ThreadFactory)c.newInstance()); 171 } catch (ClassNotFoundException x) { 172 throw new Error(x); 173 } catch (InstantiationException x) { 174 throw new Error(x); 175 } catch (IllegalAccessException x) { 176 throw new Error(x); 177 } 178 } 179 return null; 180 } 181 } | 148 149 private static int getDefaultThreadPoolInitialSize() { 150 String propValue = AccessController.doPrivileged(new 151 GetPropertyAction(DEFAULT_THREAD_POOL_INITIAL_SIZE)); 152 if (propValue != null) { 153 try { 154 return Integer.parseInt(propValue); 155 } catch (NumberFormatException x) { 156 throw new Error("Value of property '" + DEFAULT_THREAD_POOL_INITIAL_SIZE + 157 "' is invalid: " + x); 158 } 159 } 160 return -1; 161 } 162 163 private static ThreadFactory getDefaultThreadPoolThreadFactory() { 164 String propValue = AccessController.doPrivileged(new 165 GetPropertyAction(DEFAULT_THREAD_POOL_THREAD_FACTORY)); 166 if (propValue != null) { 167 try { 168 @SuppressWarnings("deprecation") 169 Object tmp = Class 170 .forName(propValue, true, ClassLoader.getSystemClassLoader()).newInstance(); 171 return (ThreadFactory)tmp; 172 } catch (ClassNotFoundException | InstantiationException | IllegalAccessException x) { 173 throw new Error(x); 174 } 175 } 176 return null; 177 } 178 } |