pnowojski commented on a change in pull request #9735: [FLINK-14156][runtime] Submit timer trigger letters to task's mailbox with operator's precedence URL: https://github.com/apache/flink/pull/9735#discussion_r333470228
########## File path: flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/TimerService.java ########## @@ -0,0 +1,77 @@ +/* + * 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.flink.streaming.runtime.tasks; + +import org.apache.flink.annotation.Internal; + +/** + * + * <p>The registration of timers follows a life cycle of three phases: + * <ol> + * <li>In the initial state, it accepts timer registrations and triggers when the time is reached.</li> + * <li>After calling {@link #quiesce()}, further calls to + * {@link #registerTimer(long, ProcessingTimeCallback)} will not register any further timers, and will + * return a "dummy" future as a result. This is used for clean shutdown, where currently firing + * timers are waited for and no future timers can be scheduled, without causing hard exceptions.</li> + * <li>After a call to {@link #shutdownService()}, all calls to {@link #registerTimer(long, ProcessingTimeCallback)} + * will result in a hard exception.</li> + * </ol> + */ +@Internal +public interface TimerService extends ProcessingTimeService { Review comment: I'm not sure if naming this interface `TimerService` is a good idea. Having 4 different interfaces/classes with the same name is pretty confusing. I would prefer to prefix them like `CEPTimerService`. @AHeise. Regarding the extraction of the lifecycle methods to a `Lifecycle` interface and implementing it in the multiple independent places. If those different classes are are not inter-exchangeably used, so the common base `Lifecycle` interface is used only to make sure that the naming convention remains consistent, I would be strongly against that. Recently I've introduce this with the `AsyncDataInput` that was implemented by couple of independent classes, and honestly that was a mistake. Whenever I was trying to look for usages of the `SingleInputGate#pollNext()` method, IntelliJ was pointing me to tons of the unrelated calls to for example `StreamTaskInput#pollNext()`. (Currently the situation has improved in the code as we introduced `PullingAsyncDataInput` and `PushingAsyncDataInput`. ---------------------------------------------------------------- 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 With regards, Apache Git Services