Author: jmaron Date: Sat May 10 21:55:44 2014 New Revision: 1593740 URL: http://svn.apache.org/r1593740 Log: SLIDER-44 modified agent provider to leverage map from curator rather than previous service instance data
Modified: incubator/slider/trunk/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java incubator/slider/trunk/slider-core/src/main/java/org/apache/slider/server/services/registry/SliderRegistryService.java Modified: incubator/slider/trunk/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java URL: http://svn.apache.org/viewvc/incubator/slider/trunk/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java?rev=1593740&r1=1593739&r2=1593740&view=diff ============================================================================== --- incubator/slider/trunk/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java (original) +++ incubator/slider/trunk/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java Sat May 10 21:55:44 2014 @@ -665,18 +665,17 @@ public class AgentProviderService extend private void buildEndpointDetails(Map<String, URL> details) { try { - List<ServiceInstanceData> services = + List services = registry.listInstancesByType(SliderKeys.APP_TYPE); assert services.size() >= 1; - ServiceInstanceData payload = services.get(0); - Map<String, RegisteredEndpoint> endpointMap = - payload.externalView.endpoints; - for (Map.Entry<String, RegisteredEndpoint> endpoint : endpointMap - .entrySet()) { - RegisteredEndpoint val = endpoint.getValue(); - if ("http".equals(val.protocol)) { - URL url = new URL(val.value); - details.put(val.description, url); + Map payload = (Map) services.get(0); + Map<String,Map> endpointMap = + (Map<String,Map>) ((Map)payload.get("externalView")).get("endpoints"); + for (Map.Entry<String,Map> endpoint : endpointMap.entrySet()) { + Map<String,String> val = endpoint.getValue(); + if ("http".equals(val.get("protocol"))) { + URL url = new URL(val.get("value")); + details.put(val.get("description"), url); } } } catch (IOException e) { Modified: incubator/slider/trunk/slider-core/src/main/java/org/apache/slider/server/services/registry/SliderRegistryService.java URL: http://svn.apache.org/viewvc/incubator/slider/trunk/slider-core/src/main/java/org/apache/slider/server/services/registry/SliderRegistryService.java?rev=1593740&r1=1593739&r2=1593740&view=diff ============================================================================== --- incubator/slider/trunk/slider-core/src/main/java/org/apache/slider/server/services/registry/SliderRegistryService.java (original) +++ incubator/slider/trunk/slider-core/src/main/java/org/apache/slider/server/services/registry/SliderRegistryService.java Sat May 10 21:55:44 2014 @@ -49,11 +49,11 @@ public class SliderRegistryService @Override - public List<ServiceInstanceData> listInstancesByType(String serviceType) throws + public List listInstancesByType(String serviceType) throws IOException { List<CuratorServiceInstance<ServiceInstanceData>> services = listInstances(serviceType); - List<ServiceInstanceData> payloads = new ArrayList<>(services.size()); + List payloads = new ArrayList(services.size()); for (CuratorServiceInstance<ServiceInstanceData> instance : services) { payloads.add(instance.payload); }