You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@curator.apache.org by ra...@apache.org on 2017/01/24 02:07:35 UTC
[4/6] curator git commit: Keep old ctor, add some doc, minor changes
Keep old ctor, add some doc, minor changes
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/27d3b109
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/27d3b109
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/27d3b109
Branch: refs/heads/CURATOR-3.0
Commit: 27d3b109723e999d463d2a29a3df79b04a53a4db
Parents: 8fe1e26
Author: randgalt <ra...@apache.org>
Authored: Mon Jan 23 21:06:16 2017 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon Jan 23 21:06:16 2017 -0500
----------------------------------------------------------------------
.../curator/x/discovery/ServiceInstance.java | 19 ++++++++++-
.../details/EnabledInstanceFilter.java | 33 --------------------
2 files changed, 18 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/27d3b109/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 820e92c..ebdd6bc 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
@@ -76,6 +76,23 @@ public class ServiceInstance<T>
* @param serviceType type of the service
* @param uriSpec the uri spec or null
*/
+ public ServiceInstance(String name, String id, String address, Integer port, Integer sslPort, T payload, long registrationTimeUTC, ServiceType serviceType, UriSpec uriSpec)
+ {
+ this(name, id, address, port, sslPort, payload, registrationTimeUTC, serviceType, uriSpec, true);
+ }
+
+ /**
+ * @param name name of the service
+ * @param id id of this instance (must be unique)
+ * @param address address of this instance
+ * @param port the port for this instance or null
+ * @param sslPort the SSL port for this instance or null
+ * @param payload the payload for this instance or null
+ * @param registrationTimeUTC the time (in UTC) of the registration
+ * @param serviceType type of the service
+ * @param uriSpec the uri spec or null
+ * @param enabled true if the instance should be considered enabled
+ */
public ServiceInstance(String name, String id, String address, Integer port, Integer sslPort, T payload, long registrationTimeUTC, ServiceType serviceType, UriSpec uriSpec, boolean enabled)
{
name = Preconditions.checkNotNull(name, "name cannot be null");
@@ -233,7 +250,7 @@ public class ServiceInstance<T>
result = 31 * result + (int)(registrationTimeUTC ^ (registrationTimeUTC >>> 32));
result = 31 * result + (serviceType != null ? serviceType.hashCode() : 0);
result = 31 * result + (uriSpec != null ? uriSpec.hashCode() : 0);
- result = 31 * result + (enabled ? 1231 : 1237);
+ result = 31 * result + (enabled ? 1 : 0);
return result;
}
http://git-wip-us.apache.org/repos/asf/curator/blob/27d3b109/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/EnabledInstanceFilter.java
----------------------------------------------------------------------
diff --git a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/EnabledInstanceFilter.java b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/EnabledInstanceFilter.java
deleted file mode 100644
index d153653..0000000
--- a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/EnabledInstanceFilter.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.curator.x.discovery.details;
-
-import org.apache.curator.x.discovery.InstanceFilter;
-import org.apache.curator.x.discovery.ServiceInstance;
-
-public class EnabledInstanceFilter<T> implements InstanceFilter<T>
-{
-
- @Override
- public boolean apply(ServiceInstance<T> instance)
- {
- return instance.isEnabled();
- }
-
-}