public class ServiceDiscoveryRecipe extends Object implements AutoCloseable
Constructor and Description |
---|
ServiceDiscoveryRecipe(AlluxioEtcdClient client,
String pathPrefix)
CTOR for ServiceDiscoveryRecipe.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
Map<String,ByteBuffer> |
getAllLiveServices()
Get all healthy service list.
|
ByteBuffer |
getRegisteredServiceDetail(String DefaultServiceEntityName)
Get the registered service value as ByteBuffer.
|
void |
registerAndStartSync(DefaultServiceEntity service)
Register service and start keeping-alive.
|
void |
unregisterAll()
Unregister all services registered from this ServiceDiscoveryRecipe instance.
|
void |
unregisterService(String serviceIdentifier)
Unregister service and close corresponding keepalive client if any.
|
void |
updateService(DefaultServiceEntity service)
Update the service value with new value.
|
public ServiceDiscoveryRecipe(AlluxioEtcdClient client, String pathPrefix)
client
- pathPrefix
- public void registerAndStartSync(DefaultServiceEntity service) throws IOException
newLeaseInternal(DefaultServiceEntity)
,
by etcd transaction semantics. We ensure that
if #newLeaseInternal succeeded, it's safe to track in mRegisteredServices map.
Other threads within same process or other processes trying to
register same named service will fail in #newLeaseInternal already.service
- IOException
public void unregisterService(String serviceIdentifier) throws IOException
serviceIdentifier
- IOException
public void unregisterAll()
public ByteBuffer getRegisteredServiceDetail(String DefaultServiceEntityName) throws IOException
DefaultServiceEntityName
- IOException
public void updateService(DefaultServiceEntity service) throws IOException
service
- IOException
public Map<String,ByteBuffer> getAllLiveServices() throws IOException
IOException
public void close()
close
in interface AutoCloseable
Copyright © 2023. All Rights Reserved.