/** * Util method to build socket addr from either: * <host>:<post> * <fs>://<host>:<port>/<path> */ public static InetSocketAddress createSocketAddr(String target) { return createSocketAddr(target, -1); }
/** * Construct an IPC client with the default SocketFactory * * @param valueClass * @param conf */ public Client() { this(NetUtils.getDefaultSocketFactory()); }
/** * Same as getInputStream(socket, socket.getSoTimeout()).<br> * <br> * From documentation for {@link #getInputStream(Socket, long)}:<br> * Returns InputStream for the socket. If the socket has an associated * SocketChannel then it returns a {@link SocketInputStream} with the given timeout. If the socket does not * have a channel, {@link Socket#getInputStream()} is returned. In the later * case, the timeout argument is ignored and the timeout set with {@link Socket#setSoTimeout(int)} applies for * reads.<br> * <br> * Any socket created using socket factories returned by {@link #NetUtils}, * must use this interface instead of {@link Socket#getInputStream()}. * * @see #getInputStream(Socket, long) * @param socket * @return InputStream for reading from the socket. * @throws IOException */ public static InputStream getInputStream(Socket socket) throws IOException { return getInputStream(socket, socket.getSoTimeout()); }
protected ExtendedManagementProtocol getJobManagerConnection(CommandLine line) throws IOException { InetSocketAddress jobManagerAddress = getJobManagerAddress(line); if (jobManagerAddress == null) { return null; } String address = jobManagerAddress.getAddress().getHostAddress(); int port = jobManagerAddress.getPort(); return RPC.getProxy(ExtendedManagementProtocol.class, new InetSocketAddress(address, port), NetUtils.getSocketFactory()); }
this.socket.setTcpNoDelay(tcpNoDelay); NetUtils.connect(this.socket, remoteId.getAddress(), 20000); this.socket.setSoTimeout(pingInterval); break; .getInputStream(socket)))); this.out = new DataOutputStream(new BufferedOutputStream(NetUtils.getOutputStream(socket))); writeHeader();
/** * Given a collection of string representation of hosts, return a list of * corresponding IP addresses in the textual representation. * * @param names * a collection of string representations of hosts * @return a list of corresponding IP addresses in the string format * @see #normalizeHostName(String) */ public static List<String> normalizeHostNames(Collection<String> names) { List<String> hostNames = new ArrayList<String>(names.size()); for (String name : names) { hostNames.add(normalizeHostName(name)); } return hostNames; } }
/** * Same as getOutputStream(socket, 0). Timeout of zero implies write will * wait until data is available.<br> * <br> * From documentation for {@link #getOutputStream(Socket, long)} : <br> * Returns OutputStream for the socket. If the socket has an associated * SocketChannel then it returns a {@link SocketOutputStream} with the given timeout. If the socket does not * have a channel, {@link Socket#getOutputStream()} is returned. In the later * case, the timeout argument is ignored and the write will wait until * data is available.<br> * <br> * Any socket created using socket factories returned by {@link #NetUtils}, * must use this interface instead of {@link Socket#getOutputStream()}. * * @see #getOutputStream(Socket, long) * @param socket * @return OutputStream for writing to the socket. * @throws IOException */ public static OutputStream getOutputStream(Socket socket) throws IOException { return getOutputStream(socket, 0); }
if (getStaticResolution(hostname) != null) { hostname = getStaticResolution(hostname);
protected ExtendedManagementProtocol getJobManagerConnection(CommandLine line) throws IOException { InetSocketAddress jobManagerAddress = getJobManagerAddress(line); if (jobManagerAddress == null) { return null; } String address = jobManagerAddress.getAddress().getHostAddress(); int port = jobManagerAddress.getPort(); return RPC.getProxy(ExtendedManagementProtocol.class, new InetSocketAddress(address, port), NetUtils.getSocketFactory()); }
this.socket.setTcpNoDelay(tcpNoDelay); NetUtils.connect(this.socket, remoteId.getAddress(), 20000); this.socket.setSoTimeout(pingInterval); break; .getInputStream(socket)))); this.out = new DataOutputStream(new BufferedOutputStream(NetUtils.getOutputStream(socket))); writeHeader();
/** * Given a collection of string representation of hosts, return a list of * corresponding IP addresses in the textual representation. * * @param names * a collection of string representations of hosts * @return a list of corresponding IP addresses in the string format * @see #normalizeHostName(String) */ public static List<String> normalizeHostNames(Collection<String> names) { List<String> hostNames = new ArrayList<String>(names.size()); for (String name : names) { hostNames.add(normalizeHostName(name)); } return hostNames; } }
/** * Same as getOutputStream(socket, 0). Timeout of zero implies write will * wait until data is available.<br> * <br> * From documentation for {@link #getOutputStream(Socket, long)} : <br> * Returns OutputStream for the socket. If the socket has an associated * SocketChannel then it returns a {@link SocketOutputStream} with the given timeout. If the socket does not * have a channel, {@link Socket#getOutputStream()} is returned. In the later * case, the timeout argument is ignored and the write will wait until * data is available.<br> * <br> * Any socket created using socket factories returned by {@link #NetUtils}, * must use this interface instead of {@link Socket#getOutputStream()}. * * @see #getOutputStream(Socket, long) * @param socket * @return OutputStream for writing to the socket. * @throws IOException */ public static OutputStream getOutputStream(Socket socket) throws IOException { return getOutputStream(socket, 0); }
if (getStaticResolution(hostname) != null) { hostname = getStaticResolution(hostname);
/** * Sets up a connection to the JobManager. * * @return Connection to the JobManager. * @throws IOException */ private ExtendedManagementProtocol getJMConnection() throws IOException { String jmHost = config.getString(ConfigConstants.JOB_MANAGER_IPC_ADDRESS_KEY, null); String jmPort = config.getString(ConfigConstants.JOB_MANAGER_IPC_PORT_KEY, null); return RPC.getProxy(ExtendedManagementProtocol.class, new InetSocketAddress(jmHost, Integer.parseInt(jmPort)), NetUtils.getSocketFactory()); }
/** * Construct an IPC client with the default SocketFactory * * @param valueClass * @param conf */ public Client() { this(NetUtils.getDefaultSocketFactory()); }
/** * Util method to build socket addr from either: * <host>:<post> * <fs>://<host>:<port>/<path> */ public static InetSocketAddress createSocketAddr(String target) { return createSocketAddr(target, -1); }
/** * Same as getInputStream(socket, socket.getSoTimeout()).<br> * <br> * From documentation for {@link #getInputStream(Socket, long)}:<br> * Returns InputStream for the socket. If the socket has an associated * SocketChannel then it returns a {@link SocketInputStream} with the given timeout. If the socket does not * have a channel, {@link Socket#getInputStream()} is returned. In the later * case, the timeout argument is ignored and the timeout set with {@link Socket#setSoTimeout(int)} applies for * reads.<br> * <br> * Any socket created using socket factories returned by {@link #NetUtils}, * must use this interface instead of {@link Socket#getInputStream()}. * * @see #getInputStream(Socket, long) * @param socket * @return InputStream for reading from the socket. * @throws IOException */ public static InputStream getInputStream(Socket socket) throws IOException { return getInputStream(socket, socket.getSoTimeout()); }
/** * Sets up a connection to the JobManager. * * @return Connection to the JobManager. * @throws IOException */ private ExtendedManagementProtocol getJMConnection() throws IOException { String jmHost = config.getString(ConfigConstants.JOB_MANAGER_IPC_ADDRESS_KEY, null); String jmPort = config.getString(ConfigConstants.JOB_MANAGER_IPC_PORT_KEY, null); return RPC.getProxy(ExtendedManagementProtocol.class, new InetSocketAddress(jmHost, Integer.parseInt(jmPort)), NetUtils.getSocketFactory()); }
public static SocketFactory getSocketFactory() { return getDefaultSocketFactory(); }
/** * Constructs a new job client object and instantiates a local * RPC proxy for the {@link JobSubmissionProtocol}. * * @param jobGraph * the job graph to run * @param configuration * configuration object which can include special configuration settings for the job client * @param jobManagerAddress * IP/Port of the jobmanager (not taken from provided configuration object). * @throws IOException * thrown on error while initializing the RPC connection to the job manager */ public JobClient(final JobGraph jobGraph, final Configuration configuration, final InetSocketAddress jobManagerAddress) throws IOException { this.jobSubmitClient = RPC.getProxy(JobManagementProtocol.class, jobManagerAddress, NetUtils.getSocketFactory()); this.jobGraph = jobGraph; this.configuration = configuration; this.jobCleanUp = new JobCleanUp(this); }