phet commented on code in PR #3890:
URL: https://github.com/apache/gobblin/pull/3890#discussion_r1522326805
##########
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/api/MultiActiveLeaseArbiter.java:
##########
@@ -82,15 +82,24 @@ abstract class LeaseAttemptStatus {}
class NoLongerLeasingStatus extends LeaseAttemptStatus {}
+
+ /** `j.u.Function` variant for an operation that may @throw IOException */
+ @FunctionalInterface
+ interface FunctionMayThrowIO<T, R> {
+ R apply(T t) throws IOException;
+ }
+
/*
The participant calling this method acquired the lease for the event in
question. `Flow 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.
+ `leaseAcquisitionTimestamp` field. `completeLeaseRunnable` is a reference to
a method that will recordLeaseSuccess
+ for the current LeaseObtainedStatus from a caller without access to the
{@link MultiActiveLeaseArbiter}
*/
@Data
class LeaseObtainedStatus extends LeaseAttemptStatus {
private final DagActionStore.DagAction flowAction;
private final long leaseAcquisitionTimestamp;
+ protected final FunctionMayThrowIO<LeaseObtainedStatus, Boolean>
completeLeaseRunnable;
Review Comment:
1. why `protected` (esp. when `@Data` already makes a `public
getCompleteLeaseRunnable()`)?
2. what's the advantage to this `Runnable` over just a field holding a MALA,
so you could provide a method:
```
public boolean completeLease() {
return mala.recordLeaseSuccess(this);
}
```
(tip: to keep that MALA reference inaccessible, even with `@Data`, put this
at the field/member level: `@Getter(AccessLevel.NONE)`)
--
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]