Sha256: 742815d5c0373728fa3d42d1687a66f4898451fc36065bd3781b2feaee0e6213

Contents?: true

Size: 1.17 KB

Versions: 6

Compression:

Stored size: 1.17 KB

Contents

package org.embulk.executor.remoteserver;

import com.github.kamatama41.nsocket.Connection;

import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

class ServerSessionRegistry {
    private final ConcurrentMap<String, ServerSession> sessionMap;

    ServerSessionRegistry() {
        this.sessionMap = new ConcurrentHashMap<>();
    }

    void register(String sessionId,
                  String systemConfig,
                  String pluginTaskConfig,
                  String processTaskConfig,
                  List<PluginArchive.GemSpec> gemSpecs,
                  byte[] pluginArchive,
                  Connection connection) {
        ServerSession session = sessionMap.computeIfAbsent(
                sessionId, (k) -> new ServerSession(
                        sessionId, systemConfig, pluginTaskConfig, processTaskConfig, gemSpecs, pluginArchive));
        session.updateConnection(connection);
    }

    ServerSession get(String sessionId) {
        return sessionMap.get(sessionId);
    }

    void remove(String sessionId) {
        ServerSession removed = sessionMap.remove(sessionId);
        removed.close();
    }
}

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/ServerSessionRegistry.java
embulk-executor-remoteserver-0.3.2 src/main/java/org/embulk/executor/remoteserver/ServerSessionRegistry.java
embulk-executor-remoteserver-0.3.1 src/main/java/org/embulk/executor/remoteserver/ServerSessionRegistry.java
embulk-executor-remoteserver-0.3.0 src/main/java/org/embulk/executor/remoteserver/ServerSessionRegistry.java
embulk-executor-remoteserver-0.2.1 src/main/java/org/embulk/executor/remoteserver/ServerSessionRegistry.java
embulk-executor-remoteserver-0.2.0 src/main/java/org/embulk/executor/remoteserver/ServerSessionRegistry.java