@Override public DuplexChannel connect(Bootstrap bootstrap) throws InterruptedException { String socketPath = getDockerClientConfig().getDockerHost().getPath(); return (DuplexChannel) bootstrap.connect(new DomainSocketAddress(socketPath)).sync().channel(); } }
@Override public String toString() { return path(); }
@Override public SocketAddress newSocketAddress(String socketPath) { checkForEpollLibrary(); return new DomainSocketAddress(socketPath); } }
@Override public String toString() { return path(); }
@Override public SocketAddress newSocketAddress(String socketPath) { checkForKqueueLibrary(); return new DomainSocketAddress(socketPath); } }
@Override public String getDataDomainSocketPath() { if (mDomainSocketDataServer != null) { return ((DomainSocketAddress) mDomainSocketDataServer.getBindAddress()).path(); } return ""; }
@Override public DuplexChannel connect(Bootstrap bootstrap) throws InterruptedException { DockerClientConfig dockerClientConfig = getDockerClientConfig(); String path = dockerClientConfig.getDockerHost().getPath(); return (DuplexChannel) bootstrap.connect(new DomainSocketAddress(path)).sync().channel(); } }
@Override protected void doClose() throws Exception { try { super.doClose(); } finally { DomainSocketAddress local = this.local; if (local != null) { // Delete the socket file if possible. File socketFile = new File(local.path()); boolean success = socketFile.delete(); if (!success && logger.isDebugEnabled()) { logger.debug("Failed to delete a domain socket file: {}", local.path()); } } } }
@Override public SocketAddress convert(io.vertx.core.net.SocketAddress address, boolean resolved) { if (address.path() != null) { return new DomainSocketAddress(address.path()); } else { if (resolved) { return new InetSocketAddress(address.host(), address.port()); } else { return InetSocketAddress.createUnresolved(address.host(), address.port()); } } }
@Override protected void doClose() throws Exception { try { super.doClose(); } finally { DomainSocketAddress local = this.local; if (local != null) { // Delete the socket file if possible. File socketFile = new File(local.path()); boolean success = socketFile.delete(); if (!success && logger.isDebugEnabled()) { logger.debug("Failed to delete a domain socket file: {}", local.path()); } } } }
@Override public SocketAddress convert(io.vertx.core.net.SocketAddress address, boolean resolved) { if (address.path() != null) { return new DomainSocketAddress(address.path()); } else { if (resolved) { return new InetSocketAddress(address.host(), address.port()); } else { return InetSocketAddress.createUnresolved(address.host(), address.port()); } } }
@Override protected void doClose() throws Exception { try { super.doClose(); } finally { DomainSocketAddress local = this.local; if (local != null) { // Delete the socket file if possible. File socketFile = new File(local.path()); boolean success = socketFile.delete(); if (!success && logger.isDebugEnabled()) { logger.debug("Failed to delete a domain socket file: {}", local.path()); } } } }
/** * Extracts dataPort socket address from Alluxio representation of network address. * * @param netAddress the input network address representation * @param conf Alluxio configuration * @return the socket address */ public static SocketAddress getDataPortSocketAddress(WorkerNetAddress netAddress, AlluxioConfiguration conf) { SocketAddress address; if (NettyUtils.isDomainSocketSupported(netAddress, conf)) { address = new DomainSocketAddress(netAddress.getDomainSocketPath()); } else { String host = netAddress.getHost(); int port = netAddress.getDataPort(); address = new InetSocketAddress(host, port); } return address; }
@Override protected void doClose() throws Exception { try { super.doClose(); } finally { DomainSocketAddress local = this.local; if (local != null) { // Delete the socket file if possible. File socketFile = new File(local.path()); boolean success = socketFile.delete(); if (!success && logger.isDebugEnabled()) { logger.debug("Failed to delete a domain socket file: {}", local.path()); } } } }
DataServer.Factory.create(new DomainSocketAddress(domainSocketPath), this);
public final boolean connect(SocketAddress socketAddress) throws IOException { int res; if (socketAddress instanceof InetSocketAddress) { InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress; NativeInetAddress address = NativeInetAddress.newInstance(inetSocketAddress.getAddress()); res = connect(fd, address.address, address.scopeId, inetSocketAddress.getPort()); } else if (socketAddress instanceof DomainSocketAddress) { DomainSocketAddress unixDomainSocketAddress = (DomainSocketAddress) socketAddress; res = connectDomainSocket(fd, unixDomainSocketAddress.path().getBytes(CharsetUtil.UTF_8)); } else { throw new Error("Unexpected SocketAddress implementation " + socketAddress); } if (res < 0) { if (res == ERRNO_EINPROGRESS_NEGATIVE) { // connect not complete yet need to wait for EPOLLOUT event return false; } throwConnectException("connect", CONNECT_REFUSED_EXCEPTION, res); } return true; }
final SocketAddress socketAddress = new DomainSocketAddress(address.getPath()); final JChannelGroup group = group(address);
public final void bind(SocketAddress socketAddress) throws IOException { if (socketAddress instanceof InetSocketAddress) { InetSocketAddress addr = (InetSocketAddress) socketAddress; NativeInetAddress address = NativeInetAddress.newInstance(addr.getAddress()); int res = bind(fd, address.address, address.scopeId, addr.getPort()); if (res < 0) { throw newIOException("bind", res); } } else if (socketAddress instanceof DomainSocketAddress) { DomainSocketAddress addr = (DomainSocketAddress) socketAddress; int res = bindDomainSocket(fd, addr.path().getBytes(CharsetUtil.UTF_8)); if (res < 0) { throw newIOException("bind", res); } } else { throw new Error("Unexpected SocketAddress implementation " + socketAddress); } }
final SocketAddress socketAddress = new DomainSocketAddress(address.getPath()); final JChannelGroup group = group(address);
public final boolean connect(SocketAddress socketAddress) throws IOException { int res; if (socketAddress instanceof InetSocketAddress) { InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress; NativeInetAddress address = NativeInetAddress.newInstance(inetSocketAddress.getAddress()); res = connect(fd, address.address, address.scopeId, inetSocketAddress.getPort()); } else if (socketAddress instanceof DomainSocketAddress) { DomainSocketAddress unixDomainSocketAddress = (DomainSocketAddress) socketAddress; res = connectDomainSocket(fd, unixDomainSocketAddress.path().getBytes(CharsetUtil.UTF_8)); } else { throw new Error("Unexpected SocketAddress implementation " + socketAddress); } if (res < 0) { if (res == ERRNO_EINPROGRESS_NEGATIVE) { // connect not complete yet need to wait for EPOLLOUT event return false; } throwConnectException("connect", CONNECT_REFUSED_EXCEPTION, res); } return true; }