Class RegistryBasedResourceClaim


  • public class RegistryBasedResourceClaim
    extends Object
    • Method Detail

      • claim

        public static RegistryBasedResourceClaim claim​(Supplier<io.etcd.jetcd.Client> connectToEtcd,
                                                       int maxGeneratorCount,
                                                       String registryEntry,
                                                       Duration acquisitionTimeout,
                                                       boolean waitWhenNoResourcesAvailable)
                                                throws IOException
        Claim a resource.
        Parameters:
        connectToEtcd - Provide a connection to Etcd.
        maxGeneratorCount - Maximum number of generators possible.
        registryEntry - Metadata stored under the Etcd key.
        acquisitionTimeout - Abort attempt to claim a resource after this duration.
        waitWhenNoResourcesAvailable - Wait for a resource to become available when all resources are claimed.
        Returns:
        The resource claim, if successful.
        Throws:
        IOException - Thrown when the claim could not be acquired.
      • getClusterId

        public int getClusterId()
      • getGeneratorId

        public int getGeneratorId()
      • close

        public void close()
      • getRegistryEntry

        public String getRegistryEntry()