use of org.apache.ignite.internal.util.ipc.IpcEndpointBindException in project ignite by apache.
the class IpcServerTcpEndpoint method start.
/** {@inheritDoc} */
@Override
public void start() throws IgniteCheckedException {
if (port <= 0 || port >= 0xffff)
throw new IpcEndpointBindException("Port value is illegal: " + port);
try {
srvSock = new ServerSocket();
assert host != null;
srvSock.bind(new InetSocketAddress(U.resolveLocalHost(host), port));
if (log.isInfoEnabled())
log.info("IPC server loopback endpoint started [port=" + port + ']');
} catch (IOException e) {
if (srvSock != null)
U.closeQuiet(srvSock);
throw new IpcEndpointBindException("Failed to bind loopback IPC endpoint (is port already in " + "use?): " + port, e);
}
}
use of org.apache.ignite.internal.util.ipc.IpcEndpointBindException in project ignite by apache.
the class IpcSharedMemoryServerEndpoint method start.
/** {@inheritDoc} */
@Override
public void start() throws IgniteCheckedException {
IpcSharedMemoryNativeLoader.load(log);
pid = IpcSharedMemoryUtils.pid();
if (pid == -1)
throw new IpcEndpointBindException("Failed to get PID of the current process.");
if (size <= 0)
throw new IpcEndpointBindException("Space size should be positive: " + size);
String tokDirPath = this.tokDirPath;
if (F.isEmpty(tokDirPath))
throw new IpcEndpointBindException("Token directory path is empty.");
tokDirPath = tokDirPath + '/' + locNodeId.toString() + '-' + IpcSharedMemoryUtils.pid();
tokDir = U.resolveWorkDirectory(workDir, tokDirPath, false);
if (port <= 0 || port >= 0xffff)
throw new IpcEndpointBindException("Port value is illegal: " + port);
try {
srvSock = new ServerSocket();
// Always bind to loopback.
srvSock.bind(new InetSocketAddress("127.0.0.1", port));
} catch (IOException e) {
// Although empty socket constructor never throws exception, close it just in case.
U.closeQuiet(srvSock);
throw new IpcEndpointBindException("Failed to bind shared memory IPC endpoint (is port already " + "in use?): " + port, e);
}
gcWorker = new GcWorker(igniteInstanceName, "ipc-shmem-gc", log);
new IgniteThread(gcWorker).start();
if (log.isInfoEnabled())
log.info("IPC shared memory server endpoint started [port=" + port + ", tokDir=" + tokDir.getAbsolutePath() + ']');
}
Aggregations