From b3a8d1bafbafa156468f374b459a18d546bd4aae Mon Sep 17 00:00:00 2001 From: Jon Marius Venstad Date: Mon, 25 Jun 2018 10:39:04 +0200 Subject: Move timeout definitions to CuratorDb --- .../api/integration/deployment/RunId.java | 55 ++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/RunId.java (limited to 'controller-api') diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/RunId.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/RunId.java new file mode 100644 index 00000000000..d78dbd6e636 --- /dev/null +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/RunId.java @@ -0,0 +1,55 @@ +package com.yahoo.vespa.hosted.controller.deployment; + +import com.yahoo.config.provision.ApplicationId; +import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType; + +import java.util.Objects; + +/** + * Immutable ID of a job run by an {@link InternalBuildService}. + * + * @author jonmv + */ +public class RunId { + + private final ApplicationId application; + private final JobType type; + private final long number; + + public RunId(ApplicationId application, JobType type, long number) { + this.application = Objects.requireNonNull(application, "ApplicationId cannot be null!"); + this.type = Objects.requireNonNull(type, "JobType cannot be null!"); + if (number <= 0) throw new IllegalArgumentException("Build number must be a positive integer!"); + this.number = number; + } + + public ApplicationId application() { return application; } + public JobType type() { return type; } + public long number() { return number; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if ( ! (o instanceof RunId)) return false; + + RunId id = (RunId) o; + + if (number != id.number) return false; + if ( ! application.equals(id.application)) return false; + return type == id.type; + } + + @Override + public int hashCode() { + int result = application.hashCode(); + result = 31 * result + type.hashCode(); + result = 31 * result + (int) (number ^ (number >>> 32)); + return result; + } + + @Override + public String toString() { + return "Run " + number + " of " + type + " for " + application; + } + +} -- cgit v1.2.3