Search in sources :

Example 1 with IgfsIpcEndpointType

use of org.apache.ignite.igfs.IgfsIpcEndpointType in project ignite by apache.

the class IgfsServer method createEndpoint.

/**
     * Create server IPC endpoint.
     *
     * @param endpointCfg Endpoint configuration.
     * @param mgmt Management flag.
     * @return Server endpoint.
     * @throws IgniteCheckedException If failed.
     */
private IpcServerEndpoint createEndpoint(IgfsIpcEndpointConfiguration endpointCfg, boolean mgmt) throws IgniteCheckedException {
    A.notNull(endpointCfg, "endpointCfg");
    IgfsIpcEndpointType typ = endpointCfg.getType();
    if (typ == null)
        throw new IgniteCheckedException("Failed to create server endpoint (type is not specified)");
    switch(typ) {
        case SHMEM:
            {
                IpcSharedMemoryServerEndpoint endpoint = new IpcSharedMemoryServerEndpoint(igfsCtx.kernalContext().config().getWorkDirectory());
                endpoint.setPort(endpointCfg.getPort());
                endpoint.setSize(endpointCfg.getMemorySize());
                endpoint.setTokenDirectoryPath(endpointCfg.getTokenDirectoryPath());
                return endpoint;
            }
        case TCP:
            {
                IpcServerTcpEndpoint endpoint = new IpcServerTcpEndpoint();
                endpoint.setHost(endpointCfg.getHost());
                endpoint.setPort(endpointCfg.getPort());
                endpoint.setManagement(mgmt);
                return endpoint;
            }
        default:
            throw new IgniteCheckedException("Failed to create server endpoint (type is unknown): " + typ);
    }
}
Also used : IgniteCheckedException(org.apache.ignite.IgniteCheckedException) IgfsIpcEndpointType(org.apache.ignite.igfs.IgfsIpcEndpointType) IpcSharedMemoryServerEndpoint(org.apache.ignite.internal.util.ipc.shmem.IpcSharedMemoryServerEndpoint) IpcServerTcpEndpoint(org.apache.ignite.internal.util.ipc.loopback.IpcServerTcpEndpoint)

Aggregations

IgniteCheckedException (org.apache.ignite.IgniteCheckedException)1 IgfsIpcEndpointType (org.apache.ignite.igfs.IgfsIpcEndpointType)1 IpcServerTcpEndpoint (org.apache.ignite.internal.util.ipc.loopback.IpcServerTcpEndpoint)1 IpcSharedMemoryServerEndpoint (org.apache.ignite.internal.util.ipc.shmem.IpcSharedMemoryServerEndpoint)1