Sha256: 6cab414cf366b73a221376dabd0898fcfe944af51fc41b2103d24277533f2bac

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

package org.embulk.executor.remoteserver;

import com.github.kamatama41.nsocket.SocketServer;

import java.io.IOException;

public class EmbulkServer implements AutoCloseable {
    private SocketServer server;

    private EmbulkServer(SocketServer  server) {
        this.server = server;
    }

    static EmbulkServer start(String host, int port, int numOfWorkers) throws IOException {
        SocketServer server = new SocketServer();
        ServerSessionRegistry sessionRegistry = new ServerSessionRegistry();
        server.setHost(host);
        server.setPort(port);
        server.setDefaultContentBufferSize(4 * 1024 * 1024); // 4MB
        server.setNumOfWorkers(numOfWorkers);
        server.registerSyncCommand(new InitializeSessionCommand(sessionRegistry));
        server.registerSyncCommand(new RemoveSessionCommand(sessionRegistry));
        server.registerCommand(new StartTaskCommand(sessionRegistry));
        server.start();
        return new EmbulkServer(server);
    }

    @Override
    public void close() throws IOException {
        server.stop();
    }
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
embulk-executor-remoteserver-0.2.1 src/main/java/org/embulk/executor/remoteserver/EmbulkServer.java
embulk-executor-remoteserver-0.2.0 src/main/java/org/embulk/executor/remoteserver/EmbulkServer.java