y1chi commented on a change in pull request #11756: URL: https://github.com/apache/beam/pull/11756#discussion_r427738041
########## File path: sdks/java/harness/src/main/java/org/apache/beam/fn/harness/FnApiDoFnRunner.java ########## @@ -1207,15 +1224,51 @@ private void output(Instant scheduledTime) { } } - private static class FnApiTimerMap implements TimerMap { - FnApiTimerMap() {} + private class FnApiTimerMap<K> implements TimerMap { + private final String timerFamilyId; + private final K userKey; + private final TimeDomain timeDomain; + private final Instant elementTimestampOrTimerHoldTimestamp; + private final Instant elementTimestampOrTimerFireTimestamp; + private final BoundedWindow boundedWindow; + private final PaneInfo paneInfo; + + FnApiTimerMap( + String timerFamilyId, + K userKey, + BoundedWindow boundedWindow, + Instant elementTimestampOrTimerHoldTimestamp, + Instant elementTimestampOrTimerFireTimestamp, + PaneInfo paneInfo) { + this.timerFamilyId = timerFamilyId; + this.userKey = userKey; + this.elementTimestampOrTimerHoldTimestamp = elementTimestampOrTimerHoldTimestamp; + this.elementTimestampOrTimerFireTimestamp = elementTimestampOrTimerFireTimestamp; + this.boundedWindow = boundedWindow; + this.paneInfo = paneInfo; + + TimerFamilyDeclaration timerFamilyDeclaration = + doFnSignature.timerFamilyDeclarations().get(timerFamilyId); + this.timeDomain = + DoFnSignatures.getTimerFamilySpecOrThrow(timerFamilyDeclaration, doFn).getTimeDomain(); + } @Override - public void set(String timerId, Instant absoluteTime) {} + public void set(String dynamicTimerTag, Instant absoluteTime) { Review comment: I believe we can always call the get() first to access FnApiTimer and call it's APIs. Probably that's sufficient enough? I feel adding more shortcuts only makes the API slightly more user-friendly. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org