Sha256: a4fdd3b593f5c2ebc63af17777406009a398efbd0b93494a8c10aa2d7f0e4ccf

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 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;

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

    static EmbulkServer start(String host, int port, int numOfWorkers) throws IOException {
        SocketServer server = new SocketServer();
        SessionManager sessionManager = new SessionManager();
        server.setHost(host);
        server.setPort(port);
        server.setDefaultContentBufferSize(4 * 1024 * 1024); // 4MB
        server.setNumOfWorkers(numOfWorkers);
        server.registerSyncCommand(new InitializeSessionCommand(sessionManager));
        server.registerSyncCommand(new RemoveSessionCommand(sessionManager));
        server.registerCommand(new StartTaskCommand(sessionManager));
        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.1.1 src/main/java/org/embulk/executor/remoteserver/EmbulkServer.java
embulk-executor-remoteserver-0.1.0 src/main/java/org/embulk/executor/remoteserver/EmbulkServer.java