@Override public void init(final Properties props) throws Exception { final Options options = new Options(props); options.setLogger(new OptionsLog(log)); print = options.getAll("print", OpenEJBHttpServer.Output.class); indent = print.size() > 0 && options.get("" + "" + ".xml", false); countStreams = options.get("stream.count", false); }
public Class get(String property, Class defaultValue) { String className = properties.getProperty(property); if (className == null) return parent.get(property, defaultValue); ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); try { return log(property, classLoader.loadClass(className)); } catch (Exception e) { getLogger().warning("Could not load " + property + " : " + className, e); return parent.get(property, defaultValue); } }
public int get(String property, int defaultValue) { String value = properties.getProperty(property); if (value == null) return parent.get(property, defaultValue); try { return log(property, Integer.parseInt(value)); } catch (NumberFormatException e) { warn(property, value, e); return parent.get(property, defaultValue); } }
public ServicePool(final ServerService next, final Options properties) { this(next, properties.get("threadsCore", 10), properties.get("threads", 150), properties.get("queue", 0), properties.get("block", true), properties.get("keepAliveTime", KEEP_ALIVE_TIME), properties.get("forceSocketClose", true)); }
@Override public void init(final Properties p) throws Exception { final Options o = new Options(p); o.setLogger(new OptionsLog(log)); this.ignore.add("localhost"); this.ignore.add("::1"); this.ignore.add("127.0.0.1"); try { final String[] ignoreList = o.get("ignore", "").split(","); for (final String s : ignoreList) { if (null != s && s.trim().length() > 0) { this.ignore.add(s.trim().toLowerCase()); } } } catch (final Exception e) { log.warning("Invalid ignore parameter. Should be a lowercase single host or comma seperated list of hosts to ignore like: ignore=host1,host2,ipv4,ipv6"); } this.multicast = o.get("bind", this.multicast); this.port = o.get("port", this.port); this.group = o.get("group", this.group); final InetAddress ia = InetAddress.getByName(this.multicast); this.address = new InetSocketAddress(ia, this.port); this.buildPacket(); }
public ClasspathSearcher() { final Options options = SystemInstance.get().getOptions(); include = options.get(CLASSPATH_INCLUDE, ".*"); exclude = options.get(CLASSPATH_EXCLUDE, ""); filterSystemApps = options.get(CLASSPATH_FILTER_SYSTEMAPPS, true); requireDescriptors = options.getAll(CLASSPATH_REQUIRE_DESCRIPTOR, RequireDescriptors.CLIENT); filterDescriptors = options.get(CLASSPATH_FILTER_DESCRIPTORS, false); }
protected <T extends Enum<T>> Set<T> getAll(String property, Set<T> defaultValue, Class<T> enumType) { String value = properties.getProperty(property); if (value == null) return parent.getAll(property, defaultValue, enumType); // Shorthand for specifying ALL or NONE for any option // that allows for multiple values of the enum if ("all".equalsIgnoreCase(value) || "true".equalsIgnoreCase(value)) { log(property, value); return EnumSet.allOf(enumType); } else if ("none".equalsIgnoreCase(value) || "false".equalsIgnoreCase(value)) { log(property, value); return EnumSet.noneOf(enumType); } try { String[] values = value.split(","); EnumSet<T> set = EnumSet.noneOf(enumType); for (String s : values) { s = s.trim(); set.add(valueOf(enumType, s.toUpperCase())); } return logAll(property, set); } catch (IllegalArgumentException e) { warn(property, value); return parent.getAll(property, defaultValue, enumType); } }
public <T extends Enum<T>> Set<T> getAll(final String property, final Class<T> enumType) { return getAll(property, Collections.EMPTY_SET, enumType); }
public ServicePool(final ServerService next, final Properties properties) { /**Defaults. * This suggests that 10 core threads should cope with up to 19 runnables (threads + queue, whereby queue = threads - 1). * Any more than 19 runnables will spawn a thread to cope if the thread count is less than 150. * If 150 threads are processing runnables and the queue is full then block and wait for * a slot for up to 10 seconds before rejecting the runnable. * If a thread remains idle for more than 1 minute then it will be removed. */ this(next, new Options(properties)); } public ServicePool(final ServerService next, final Options properties) {
public void setLogger(final Log logger) { parent.setLogger(logger); }
public Log getLogger() { return parent.getLogger(); }
public RemoteServer(final int tries, final boolean verbose) { this.tries = (tries < 1 ? 1 : (tries > 3600 ? 3600 : tries)); //Wait at least 1 second to start or stop, but not more than an hour. this.verbose = verbose; home = getHome(); tomcat = (home != null) && (new File(new File(home, "bin"), "catalina.sh").exists()); portShutdown = options.get(SERVER_SHUTDOWN_PORT, tomcat ? 8005 : 4200); portStartup = portShutdown; command = options.get(SERVER_SHUTDOWN_COMMAND, "SHUTDOWN"); host = options.get(SERVER_SHUTDOWN_HOST, "localhost"); connectTimeout = options.get(SOCKET_TIMEOUT, 1000); }
@Override public void init(final Properties props) { final Options options = new Options(props); options.setLogger(new OptionsLog(log)); host = props.getProperty("bind", host); loopbackMode = options.get("loopback_mode", loopbackMode); port = options.get("port", port); heartRate = options.get("heart_rate", heartRate); final Tracker.Builder builder = new Tracker.Builder(); builder.setGroup(props.getProperty("group", builder.getGroup())); builder.setHeartRate(heartRate); builder.setMaxMissedHeartbeats(options.get("max_missed_heartbeats", builder.getMaxMissedHeartbeats())); builder.setMaxReconnectDelay(options.get("max_reconnect_delay", builder.getMaxReconnectDelay())); builder.setReconnectDelay(options.get("reconnect_delay", builder.getReconnectDelay())); builder.setExponentialBackoff(options.get("exponential_backoff", builder.getExponentialBackoff())); builder.setMaxReconnectAttempts(options.get("max_reconnect_attempts", builder.getMaxReconnectAttempts())); tracker = builder.build(); }
public long get(final String property, final long defaultValue) { final String value = properties.getProperty(property); if (value == null || value.equals("")) { return parent.get(property, defaultValue); } try { return log(property, Long.parseLong(value)); } catch (final NumberFormatException e) { warn(property, value, e); return parent.get(property, defaultValue); } }
protected <T extends Enum<T>> Set<T> getAll(final String property, final Set<T> defaultValue, final Class<T> enumType) { final String value = properties.getProperty(property); if (value == null || value.equals("")) { return parent.getAll(property, defaultValue, enumType); } // Shorthand for specifying ALL or NONE for any option // that allows for multiple values of the enum if ("all".equalsIgnoreCase(value) || "true".equalsIgnoreCase(value)) { log(property, value); return EnumSet.allOf(enumType); } else if ("none".equalsIgnoreCase(value) || "false".equalsIgnoreCase(value)) { log(property, value); return EnumSet.noneOf(enumType); } try { final String[] values = value.split(","); final EnumSet<T> set = EnumSet.noneOf(enumType); for (String s : values) { s = s.trim(); set.add(valueOf(enumType, s.toUpperCase())); } return logAll(property, set); } catch (final IllegalArgumentException e) { warn(property, value); return parent.getAll(property, defaultValue, enumType); } }
public <T extends Enum<T>> Set<T> getAll(final String property, final Class<T> enumType) { return getAll(property, Collections.EMPTY_SET, enumType); }
public DeploymentContext(final String id, final Options parent) { this.id = id; this.options = new Options(properties, parent); }
public void setLogger(final Log logger) { parent.setLogger(logger); }