Package org.lable.oss.uniqueid.etcd
Class RegistryBasedGeneratorIdentity
- java.lang.Object
-
- org.lable.oss.uniqueid.etcd.RegistryBasedGeneratorIdentity
-
- All Implemented Interfaces:
Closeable,AutoCloseable,GeneratorIdentityHolder
public class RegistryBasedGeneratorIdentity extends Object implements GeneratorIdentityHolder
Holder for a claimed cluster-id and generator-id that once claimed remains claimed without an active connection to an Etcd cluster. The claim is relinquished upon callingclose()(where a new connection to Etcd will be set up briefly).
-
-
Constructor Summary
Constructors Constructor Description RegistryBasedGeneratorIdentity(String endpoints, String namespace, String registryEntry)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static RegistryBasedGeneratorIdentitybasedOn(String endpoints, String namespace, String registryEntry)voidclose()intgetClusterId()intgetGeneratorId()StringgetRegistryEntry()
-
-
-
Method Detail
-
basedOn
public static RegistryBasedGeneratorIdentity basedOn(String endpoints, String namespace, String registryEntry) throws IOException
- Throws:
IOException
-
getClusterId
public int getClusterId() throws GeneratorException- Specified by:
getClusterIdin interfaceGeneratorIdentityHolder- Throws:
GeneratorException
-
getGeneratorId
public int getGeneratorId() throws GeneratorException- Specified by:
getGeneratorIdin interfaceGeneratorIdentityHolder- Throws:
GeneratorException
-
getRegistryEntry
public String getRegistryEntry()
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
-