Search in sources :

Example 6 with Instance

use of com.tencent.polaris.client.pb.ServiceProto.Instance in project polaris-java by polarismesh.

the class NamingService method addInstance.

public void addInstance(ServiceKey svcKey, Node node, InstanceParameter parameter) {
    ServiceProto.Instance instance = buildInstance(svcKey, node, parameter);
    List<Instance> existsInstances = services.get(svcKey);
    if (null == existsInstances) {
        List<Instance> instances = new ArrayList<>();
        instances.add(instance);
        services.put(svcKey, instances);
    } else {
        existsInstances.add(instance);
    }
}
Also used : Instance(com.tencent.polaris.client.pb.ServiceProto.Instance) ArrayList(java.util.ArrayList) Instance(com.tencent.polaris.client.pb.ServiceProto.Instance) ServiceProto(com.tencent.polaris.client.pb.ServiceProto)

Aggregations

Instance (com.tencent.polaris.client.pb.ServiceProto.Instance)6 ServiceProto (com.tencent.polaris.client.pb.ServiceProto)5 ServiceKey (com.tencent.polaris.api.pojo.ServiceKey)3 ArrayList (java.util.ArrayList)3 PolarisException (com.tencent.polaris.api.exception.PolarisException)1 DefaultInstance (com.tencent.polaris.api.pojo.DefaultInstance)1 ServiceInfo (com.tencent.polaris.api.pojo.ServiceInfo)1 Services (com.tencent.polaris.api.pojo.Services)1 CircuitBreakerProto (com.tencent.polaris.client.pb.CircuitBreakerProto)1 CircuitBreaker (com.tencent.polaris.client.pb.CircuitBreakerProto.CircuitBreaker)1 RateLimitProto (com.tencent.polaris.client.pb.RateLimitProto)1 RateLimit (com.tencent.polaris.client.pb.RateLimitProto.RateLimit)1 DiscoverResponse (com.tencent.polaris.client.pb.ResponseProto.DiscoverResponse)1 RoutingProto (com.tencent.polaris.client.pb.RoutingProto)1 Service (com.tencent.polaris.client.pb.ServiceProto.Service)1 Node (com.tencent.polaris.client.pojo.Node)1 DestroyableServerConnector (com.tencent.polaris.plugins.connector.common.DestroyableServerConnector)1 HashMap (java.util.HashMap)1 List (java.util.List)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1