public static URL newURL(String scheme, String host, int port, String file) { URL url = recordFactory.newRecordInstance(URL.class); url.setScheme(scheme); url.setHost(host); url.setPort(port); url.setFile(file); return url; }
/** * Convert a YARN URL into a string value of a normal URL * * @param url URL * @return string representatin */ public static String stringify(org.apache.hadoop.yarn.api.records.URL url) { StringBuilder builder = new StringBuilder(); builder.append(url.getScheme()).append("://"); if (url.getHost() != null) { builder.append(url.getHost()).append(":").append(url.getPort()); } builder.append(url.getFile()); return builder.toString(); }
private LocalResource createLocalResource(String name) { LocalResource lr = LocalResource.newInstance( URL.newInstance(null, "localhost", 2321, name), LocalResourceType.FILE, LocalResourceVisibility.APPLICATION, 1, 1000000); return lr; }