All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.quorum.tessera.server.TesseraServerFactory Maven / Gradle / Ivy

There is a newer version: 0.11.0.30092019161842
Show newest version
package com.quorum.tessera.server;

import com.quorum.tessera.ServiceLoaderUtil;
import com.quorum.tessera.config.CommunicationType;
import com.quorum.tessera.config.ServerConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Set;

public interface TesseraServerFactory {

    Logger LOGGER = LoggerFactory.getLogger(TesseraServerFactory.class);

    TesseraServer createServer(ServerConfig config, Set services);

    CommunicationType communicationType();

    static TesseraServerFactory create(CommunicationType communicationType) {
        return ServiceLoaderUtil.loadAll(TesseraServerFactory.class)
                .filter(f -> f.communicationType() == communicationType)
                .findFirst()
                .orElseThrow(() -> new IllegalStateException("No server factory found for " + communicationType));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy