curator-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From randg...@apache.org
Subject git commit: service discovery is feature complete - needs testing
Date Fri, 30 May 2014 22:29:46 GMT
Repository: curator
Updated Branches:
  refs/heads/curator-rpc b79909a4c -> 2998114ba


service discovery is feature complete - needs testing


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/2998114b
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/2998114b
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/2998114b

Branch: refs/heads/curator-rpc
Commit: 2998114ba1674746777f82554cd031131e4c721c
Parents: b79909a
Author: randgalt <randgalt@apache.org>
Authored: Fri May 30 17:29:39 2014 -0500
Committer: randgalt <randgalt@apache.org>
Committed: Fri May 30 17:29:39 2014 -0500

----------------------------------------------------------------------
 .../org/apache/curator/x/discovery/ServiceInstance.java     | 2 +-
 .../curator/x/rpc/idl/discovery/DiscoveryInstance.java      | 7 +++++++
 .../curator/x/rpc/idl/discovery/DiscoveryService.java       | 2 +-
 .../x/rpc/idl/discovery/DiscoveryServiceLowLevel.java       | 9 +++------
 4 files changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/2998114b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/ServiceInstance.java
----------------------------------------------------------------------
diff --git a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/ServiceInstance.java
b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/ServiceInstance.java
index 3572be6..29779b1 100644
--- a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/ServiceInstance.java
+++ b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/ServiceInstance.java
@@ -75,7 +75,7 @@ public class ServiceInstance<T>
      * @param serviceType type of the service
      * @param uriSpec the uri spec or null
      */
-    ServiceInstance(String name, String id, String address, Integer port, Integer sslPort,
T payload, long registrationTimeUTC, ServiceType serviceType, UriSpec uriSpec)
+    public ServiceInstance(String name, String id, String address, Integer port, Integer
sslPort, T payload, long registrationTimeUTC, ServiceType serviceType, UriSpec uriSpec)
     {
         name = Preconditions.checkNotNull(name, "name cannot be null");
         id = Preconditions.checkNotNull(id, "id cannot be null");

http://git-wip-us.apache.org/repos/asf/curator/blob/2998114b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/discovery/DiscoveryInstance.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/discovery/DiscoveryInstance.java
b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/discovery/DiscoveryInstance.java
index 4cd67d6..a6f35cd 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/discovery/DiscoveryInstance.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/discovery/DiscoveryInstance.java
@@ -3,6 +3,8 @@ package org.apache.curator.x.rpc.idl.discovery;
 import com.facebook.swift.codec.ThriftField;
 import com.facebook.swift.codec.ThriftStruct;
 import org.apache.curator.x.discovery.ServiceInstance;
+import org.apache.curator.x.discovery.ServiceType;
+import org.apache.curator.x.discovery.UriSpec;
 
 @ThriftStruct
 public class DiscoveryInstance
@@ -66,4 +68,9 @@ public class DiscoveryInstance
         this.serviceType = serviceType;
         this.uriSpec = uriSpec;
     }
+
+    public ServiceInstance<byte[]> toReal()
+    {
+        return new ServiceInstance<byte[]>(name, id, address, port, sslPort, payload,
registrationTimeUTC, ServiceType.valueOf(serviceType.name()), new UriSpec(uriSpec));
+    }
 }

http://git-wip-us.apache.org/repos/asf/curator/blob/2998114b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/discovery/DiscoveryService.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/discovery/DiscoveryService.java
b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/discovery/DiscoveryService.java
index 5ed9a01..a85f113 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/discovery/DiscoveryService.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/discovery/DiscoveryService.java
@@ -47,7 +47,7 @@ public class DiscoveryService
                 .builder(byte[].class)
                 .basePath(basePath)
                 .client(entry.getClient())
-                .thisInstance(null) // TODO
+                .thisInstance(yourInstance.toReal())
                 .build();
             serviceDiscovery.start();
 

http://git-wip-us.apache.org/repos/asf/curator/blob/2998114b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/discovery/DiscoveryServiceLowLevel.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/discovery/DiscoveryServiceLowLevel.java
b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/discovery/DiscoveryServiceLowLevel.java
index fa7dbfe..4c6945f 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/discovery/DiscoveryServiceLowLevel.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/discovery/DiscoveryServiceLowLevel.java
@@ -10,14 +10,11 @@ import org.apache.curator.x.rpc.connections.ConnectionManager;
 import org.apache.curator.x.rpc.connections.CuratorEntry;
 import org.apache.curator.x.rpc.idl.exceptions.RpcException;
 import org.apache.curator.x.rpc.idl.structs.CuratorProjection;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import java.util.Collection;
 
 @ThriftService
 public class DiscoveryServiceLowLevel
 {
-    private final Logger log = LoggerFactory.getLogger(getClass());
     private final ConnectionManager connectionManager;
 
     public DiscoveryServiceLowLevel(ConnectionManager connectionManager)
@@ -33,7 +30,7 @@ public class DiscoveryServiceLowLevel
             CuratorEntry entry = CuratorEntry.mustGetEntry(connectionManager, projection);
             @SuppressWarnings("unchecked")
             ServiceDiscovery<byte[]> serviceDiscovery = CuratorEntry.mustGetThing(entry,
discoveryProjection.id, ServiceDiscovery.class);
-            serviceDiscovery.registerService(null); // TODO
+            serviceDiscovery.registerService(instance.toReal());
         }
         catch ( Exception e )
         {
@@ -49,7 +46,7 @@ public class DiscoveryServiceLowLevel
             CuratorEntry entry = CuratorEntry.mustGetEntry(connectionManager, projection);
             @SuppressWarnings("unchecked")
             ServiceDiscovery<byte[]> serviceDiscovery = CuratorEntry.mustGetThing(entry,
discoveryProjection.id, ServiceDiscovery.class);
-            serviceDiscovery.updateService(null); // TODO
+            serviceDiscovery.updateService(instance.toReal());
         }
         catch ( Exception e )
         {
@@ -65,7 +62,7 @@ public class DiscoveryServiceLowLevel
             CuratorEntry entry = CuratorEntry.mustGetEntry(connectionManager, projection);
             @SuppressWarnings("unchecked")
             ServiceDiscovery<byte[]> serviceDiscovery = CuratorEntry.mustGetThing(entry,
discoveryProjection.id, ServiceDiscovery.class);
-            serviceDiscovery.unregisterService(null); // TODO
+            serviceDiscovery.unregisterService(instance.toReal());
         }
         catch ( Exception e )
         {


Mime
View raw message