umustafi commented on code in PR #3904: URL: https://github.com/apache/gobblin/pull/3904#discussion_r1542113434
########## gobblin-service/src/main/java/org/apache/gobblin/service/modules/orchestration/LeaseAttemptStatus.java: ########## @@ -0,0 +1,94 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.gobblin.service.modules.orchestration; + +import java.io.IOException; + +import lombok.AccessLevel; +import lombok.Data; +import lombok.Getter; + + +/* + Class used to encapsulate status of lease acquisition attempt and derivations should contain information specific to + the status that results. The #getDagAction and #getMinimumLingerDurationMillis are meant to be overriden and used by + relevant derived classes. + */ +public abstract class LeaseAttemptStatus { + public DagActionStore.DagAction getDagAction() { + return null; + } + + public long getMinimumLingerDurationMillis() { + return 0; + } + + public static class NoLongerLeasingStatus extends LeaseAttemptStatus {} + + /* + The participant calling this method acquired the lease for the event in question. `Dag action`'s flow execution id + is the timestamp associated with the lease and the time the caller obtained the lease is stored within the + `leaseAcquisitionTimestamp` field. The `multiActiveLeaseArbiter` reference is used to recordLeaseSuccess for the + current LeaseObtainedStatus via the completeLease method from a caller without access to the {@link MultiActiveLeaseArbiter}. + */ + @Data + public static class LeaseObtainedStatus extends LeaseAttemptStatus { Review Comment: I agree that it's much easier to understand these classes when lie together in one file. I am okay with them being separated from the MALA file since removing the prefix from every place they are used makes code more readable and concise. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
