You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@slider.apache.org by st...@apache.org on 2014/06/19 02:51:04 UTC

[2/5] git commit: SLIDER-149 changing endpoint design to match current thoughts on what a YARN registry should do

SLIDER-149 changing endpoint design to match current thoughts on what a YARN registry should do


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/86cabdc4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/86cabdc4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/86cabdc4

Branch: refs/heads/develop
Commit: 86cabdc427d59a5daf60c94bb5b00d7361391f81
Parents: 846310c
Author: Steve Loughran <st...@apache.org>
Authored: Wed Jun 18 16:32:36 2014 -0700
Committer: Steve Loughran <st...@apache.org>
Committed: Wed Jun 18 16:48:14 2014 -0700

----------------------------------------------------------------------
 .../core/registry/info/RegisteredEndpoint.java  | 43 +++++++++++++-------
 .../core/registry/info/ServiceInstanceData.java |  2 +
 .../providers/AbstractProviderService.java      |  2 +-
 .../server/services/curator/CuratorUriSpec.java |  2 +-
 4 files changed, 32 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/86cabdc4/slider-core/src/main/java/org/apache/slider/core/registry/info/RegisteredEndpoint.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/registry/info/RegisteredEndpoint.java b/slider-core/src/main/java/org/apache/slider/core/registry/info/RegisteredEndpoint.java
index 3dae7fc..dc335c6 100644
--- a/slider-core/src/main/java/org/apache/slider/core/registry/info/RegisteredEndpoint.java
+++ b/slider-core/src/main/java/org/apache/slider/core/registry/info/RegisteredEndpoint.java
@@ -48,7 +48,12 @@ public class RegisteredEndpoint {
   /**
    * "hostname:port" pair: {@value}
    */
-  public static final String TYPE_ADDRESS = "address";
+  public static final String TYPE_INETADDRESS = "inetaddress";
+  
+  /**
+   * simple path string: {@value}
+   */
+  public static final String TYPE_PATH = "path";
 
   // standard protocols
 
@@ -86,19 +91,31 @@ public class RegisteredEndpoint {
    */
   public static final String PROTOCOL_HADOOP_PROTOBUF = "org.apache.hadoop.ipc.Protobuf";
 
-  public String value;
+  /**
+   * The address -format is driven by the type entry
+   */
+  public String address;
+
+  /**
+   * Protocol
+   */
   public String protocol = "";
+
   public String type = "";
+
+  /**
+   * Human readable type
+   */
   public String description = "";
   
   public RegisteredEndpoint() {
   }
 
-  public RegisteredEndpoint(String value,
+  public RegisteredEndpoint(String address,
                             String protocol,
                             String type,
                             String description) {
-    this.value = value;
+    this.address = address;
     this.protocol = protocol;
     this.type = type;
     this.description = description;
@@ -113,7 +130,7 @@ public class RegisteredEndpoint {
   public RegisteredEndpoint(URI uri,
                             String description) {
     
-    this.value = uri.toString();
+    this.address = uri.toString();
     this.protocol = uri.getScheme();
     this.type = TYPE_URL;
     this.description = description;
@@ -128,9 +145,9 @@ public class RegisteredEndpoint {
     String protocol,
       String description) {
     
-    this.value = address.toString();
+    this.address = address.toString();
     this.protocol = protocol;
-    this.type = TYPE_ADDRESS;
+    this.type = TYPE_INETADDRESS;
     this.description = description;
   }
 
@@ -153,10 +170,10 @@ public class RegisteredEndpoint {
   public URL asURL() throws SliderException {
     verifyEndpointType(TYPE_URL);
     try {
-      return new URL(value);
+      return new URL(address);
     } catch (MalformedURLException e) {
       throw new SliderException(-1, e,
-          "could not create a URL from %s : %s", value, e.toString());
+          "could not create a URL from %s : %s", address, e.toString());
     }
   }
 
@@ -165,20 +182,16 @@ public class RegisteredEndpoint {
     final StringBuilder sb =
         new StringBuilder();
     if (TYPE_URL.equals(type)) {
-      sb.append(value);
+      sb.append(address);
     } else {
       sb.append("protocol='").append(protocol).append('\'');
-      sb.append(" value='").append(value).append('\'');
+      sb.append(" address='").append(address).append('\'');
       sb.append(" type='").append(type).append('\'');
     }
     sb.append(" -- \"").append(description).append('"');
     return sb.toString();
   }
 
-  @JsonIgnore
-  public boolean isHttpProtocol() {
-    return PROTOCOL_HTTP.equals(protocol) || PROTOCOL_HTTPS.equals(protocol);
-  }
 
   /**
    * Verify that an endpoint is of the desired type

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/86cabdc4/slider-core/src/main/java/org/apache/slider/core/registry/info/ServiceInstanceData.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/registry/info/ServiceInstanceData.java b/slider-core/src/main/java/org/apache/slider/core/registry/info/ServiceInstanceData.java
index 1d8c561..80f0b34 100644
--- a/slider-core/src/main/java/org/apache/slider/core/registry/info/ServiceInstanceData.java
+++ b/slider-core/src/main/java/org/apache/slider/core/registry/info/ServiceInstanceData.java
@@ -39,6 +39,8 @@ public class ServiceInstanceData implements Serializable {
 
   public String serviceType;
   public String id;
+  public String description;
+  public String yarnApplicationId;
   public long registrationTimeUTC;
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/86cabdc4/slider-core/src/main/java/org/apache/slider/providers/AbstractProviderService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/AbstractProviderService.java b/slider-core/src/main/java/org/apache/slider/providers/AbstractProviderService.java
index 7c9b38e..0182fb7 100644
--- a/slider-core/src/main/java/org/apache/slider/providers/AbstractProviderService.java
+++ b/slider-core/src/main/java/org/apache/slider/providers/AbstractProviderService.java
@@ -300,7 +300,7 @@ public abstract class AbstractProviderService
     for (Map.Entry<String, RegisteredEndpoint> endpoint : endpoints.entrySet()) {
       RegisteredEndpoint val = endpoint.getValue();
       if (val.type.equals(RegisteredEndpoint.TYPE_URL)) {
-          details.put(val.description, val.value);
+          details.put(val.description, val.address);
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/86cabdc4/slider-core/src/main/java/org/apache/slider/server/services/curator/CuratorUriSpec.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/services/curator/CuratorUriSpec.java b/slider-core/src/main/java/org/apache/slider/server/services/curator/CuratorUriSpec.java
index b2a877a..adda359 100644
--- a/slider-core/src/main/java/org/apache/slider/server/services/curator/CuratorUriSpec.java
+++ b/slider-core/src/main/java/org/apache/slider/server/services/curator/CuratorUriSpec.java
@@ -28,7 +28,7 @@ import java.util.List;
 @JsonIgnoreProperties(ignoreUnknown = true)
 public class CuratorUriSpec extends UriSpec{
 
-  private final List<Part>        parts = Lists.newArrayList();
+  private final List<Part> parts = Lists.newArrayList();
 
   public CuratorUriSpec() {
     super();