Search in sources :

Example 1 with OptionsLog

use of org.apache.openejb.util.OptionsLog in project tomee by apache.

the class MulticastDiscoveryAgent method init.

@Override
public void init(final Properties props) {
    final Options options = new Options(props);
    options.setLogger(new OptionsLog(LOGGER));
    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();
}
Also used : Options(org.apache.openejb.loader.Options) OptionsLog(org.apache.openejb.util.OptionsLog)

Example 2 with OptionsLog

use of org.apache.openejb.util.OptionsLog in project tomee by apache.

the class MultipointDiscoveryAgent method init.

@Override
public void init(final Properties props) {
    final Options options = new Options(props);
    options.setLogger(new OptionsLog(LOGGER));
    host = props.getProperty("bind", host);
    port = options.get("port", port);
    initialServers = options.get("initialServers", initialServers);
    heartRate = options.get("heart_rate", heartRate);
    discoveryHost = options.get("discoveryHost", host);
    name = name != null ? name : options.get("discoveryName", MultipointServer.randomColor());
    reconnectDelay = options.get("reconnectDelay", new Duration("30 seconds"));
    final Set<URI> uris = new LinkedHashSet<>();
    // Connect the initial set of peer servers
    final StringTokenizer st = new StringTokenizer(initialServers, ",");
    while (st.hasMoreTokens()) {
        final String string = st.nextToken().trim();
        if (string.startsWith("conn://")) {
            final URI uri = URI.create(string);
            uris.add(uri);
        } else {
            final URI uri = URI.create("conn://" + string);
            uris.add(uri);
        }
    }
    roots = uris;
    final Tracker.Builder builder = new Tracker.Builder();
    builder.setHeartRate(heartRate);
    builder.setGroup(props.getProperty("group", builder.getGroup()));
    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()));
    builder.setDebug(debug);
    tracker = builder.build();
}
Also used : LinkedHashSet(java.util.LinkedHashSet) Options(org.apache.openejb.loader.Options) StringTokenizer(java.util.StringTokenizer) OptionsLog(org.apache.openejb.util.OptionsLog) Duration(org.apache.openejb.util.Duration) URI(java.net.URI)

Example 3 with OptionsLog

use of org.apache.openejb.util.OptionsLog in project tomee by apache.

the class MulticastPulseAgent method init.

@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();
}
Also used : Options(org.apache.openejb.loader.Options) InetSocketAddress(java.net.InetSocketAddress) OptionsLog(org.apache.openejb.util.OptionsLog) InetAddress(java.net.InetAddress) SocketException(java.net.SocketException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException) ServiceException(org.apache.openejb.server.ServiceException)

Example 4 with OptionsLog

use of org.apache.openejb.util.OptionsLog in project tomee by apache.

the class OpenEJBHttpServer method init.

@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);
}
Also used : Options(org.apache.openejb.loader.Options) OptionsLog(org.apache.openejb.util.OptionsLog)

Aggregations

Options (org.apache.openejb.loader.Options)4 OptionsLog (org.apache.openejb.util.OptionsLog)4 IOException (java.io.IOException)1 InetAddress (java.net.InetAddress)1 InetSocketAddress (java.net.InetSocketAddress)1 SocketException (java.net.SocketException)1 URI (java.net.URI)1 UnknownHostException (java.net.UnknownHostException)1 LinkedHashSet (java.util.LinkedHashSet)1 StringTokenizer (java.util.StringTokenizer)1 ServiceException (org.apache.openejb.server.ServiceException)1 Duration (org.apache.openejb.util.Duration)1