示例#1
0
 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;
 }
示例#2
0
 /**
  * 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();
 }
示例#3
0
 private LocalResource createLocalResource(String name) {
   LocalResource lr =
       LocalResource.newInstance(
           URL.newInstance(null, "localhost", 2321, name),
           LocalResourceType.FILE,
           LocalResourceVisibility.APPLICATION,
           1,
           1000000);
   return lr;
 }