/**
  * Copying constructor.
  *
  * @param cfg Configuration to copy.
  */
 public IgfsIpcEndpointConfiguration(IgfsIpcEndpointConfiguration cfg) {
   type = cfg.getType();
   host = cfg.getHost();
   port = cfg.getPort();
   memSize = cfg.getMemorySize();
   tokenDirPath = cfg.getTokenDirectoryPath();
 }
  static {
    PRIMARY_REST_CFG = new IgfsIpcEndpointConfiguration();

    PRIMARY_REST_CFG.setType(IgfsIpcEndpointType.TCP);
    PRIMARY_REST_CFG.setPort(10500);

    SECONDARY_REST_CFG = new IgfsIpcEndpointConfiguration();

    SECONDARY_REST_CFG.setType(IgfsIpcEndpointType.TCP);
    SECONDARY_REST_CFG.setPort(11500);
  }
示例#3
0
  /**
   * 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);
    }
  }