Hmm - that’s a good point. I wonder if PERMANENT should be excluded. The idea 
here is that the instance is going down so any services that it registered 
should go down too. But, I can see an argument that PERMANENT should not. 
However, this implementation has been released for a long time so I’d be 
concerned about breaking existing code. Maybe a method could be added to 
designate which service types are unregistered when the ServiceDiscovery 
instance is closed.

-JZ

From: Huang, Ying-Yi Huang, Ying-Yi
Reply: Huang, Ying-Yi [email protected]
Date: February 10, 2014 at 7:43:59 PM
To: Jordan Zimmerman [email protected]
Subject:  Re: Static/Permanent service type  
Services registered with service discovery would get unregistered when close() 
is called. This will remove all services including static and permanent. Is 
this the designed behavior?  

public class ServiceDiscoveryImpl<T> implements ServiceDiscovery<T>  
{  
@Override  
public void close() throws IOException  
{  
for ( ServiceCache<T> cache : Lists.newArrayList(caches) )  
{  
Closeables.closeQuietly(cache);  
}  
for ( ServiceProvider<T> provider : Lists.newArrayList(providers) )  
{  
Closeables.closeQuietly(provider);  
}  

for ( ServiceInstance<T> service : services.values() )  
{  
try  
{  
unregisterService(service);  
}  
catch ( Exception e )  
{  
log.error("Could not unregister instance: " + service.getName(), e);  
}  
}  

client.getConnectionStateListenable().removeListener(connectionStateListener);  
}  
}  

Thanks,  
Ying-Yi  
On Feb 7, 2014, at 6:24 PM, Jordan Zimmerman 
<[email protected]<mailto:[email protected]>>  
wrote:  

ServiceType.DYNAMIC is not supported. It makes sense because there is no 
session for the REST API.  

-JZ  

________________________________  
From: Huang, Ying-Yi Huang, Ying-Yi<mailto:[email protected]>  
Reply: Huang, Ying-Yi [email protected]<mailto:[email protected]>  
Date: February 7, 2014 at 1:29:12 PM  
To: Jordan Zimmerman 
[email protected]<mailto:[email protected]>  
Subject: Re: Static/Permanent service type  
A general question is that are all three types of services supported in Java 
API and RESTFul API?  

Reply via email to