Sha256: 10b1b9d8df4448b3f8594f65ac8d53e8f0d1608bcb66cad5441cf158ab028e5f

Contents?: true

Size: 829 Bytes

Versions: 6

Compression:

Stored size: 829 Bytes

Contents

package org.embulk.executor.remoteserver;

import java.net.InetSocketAddress;

class Host {
    private String name;
    private int port;

    Host(String name, int port) {
        this.name = name;
        this.port = port;
    }

    String getName() {
        return name;
    }

    int getPort() {
        return port;
    }

    InetSocketAddress toAddress() {
        return new InetSocketAddress(name, port);
    }

    static Host of(String host) {
        String[] split = host.split(":");
        if (split.length > 2) {
            throw new IllegalArgumentException("Host must be the format 'hostname(:port)' but " + host);
        }
        if (split.length == 1) {
            return new Host(split[0], 30001);
        } else {
            return new Host(split[0], Integer.parseInt(split[1]));
        }
    }
}

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
embulk-executor-remoteserver-0.4.0 src/main/java/org/embulk/executor/remoteserver/Host.java
embulk-executor-remoteserver-0.3.2 src/main/java/org/embulk/executor/remoteserver/Host.java
embulk-executor-remoteserver-0.3.1 src/main/java/org/embulk/executor/remoteserver/Host.java
embulk-executor-remoteserver-0.3.0 src/main/java/org/embulk/executor/remoteserver/Host.java
embulk-executor-remoteserver-0.2.1 src/main/java/org/embulk/executor/remoteserver/Host.java
embulk-executor-remoteserver-0.2.0 src/main/java/org/embulk/executor/remoteserver/Host.java