mosche commented on code in PR #22525:
URL: https://github.com/apache/beam/pull/22525#discussion_r936296176


##########
runners/core-java/src/main/java/org/apache/beam/runners/core/InMemoryTimerInternals.java:
##########
@@ -155,10 +156,18 @@ public void setTimer(TimerData timerData) {
   @Override
   public void deleteTimer(
       StateNamespace namespace, String timerId, String timerFamilyId, 
TimeDomain timeDomain) {
-    throw new UnsupportedOperationException("Canceling a timer by ID is not 
yet supported.");
+    TimerData removedTimer = existingTimers.remove(namespace, timerId + '+' + 
timerFamilyId);
+    if (removedTimer != null) {
+      Preconditions.checkState(
+          removedTimer.getDomain().equals(timeDomain),
+          "%s doesn't match time domain %s of timer",
+          timeDomain,
+          removedTimer.getDomain());

Review Comment:
   I did that initially, but removed the additional lookup again again as a 
timer is uniquely identified by `namespace` + `timerId`. I added this as sanity 
check here to detect any broken state, but as far as I understand this should 
never be the case. 



-- 
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]

Reply via email to