-
Notifications
You must be signed in to change notification settings - Fork 331
SAMZA-1880: Rename non-metrics classes which use Timer in their name #644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
67c3608
SAMZA-1880: Rename non-metrics classes which use Timer in their name
cameronlee314 db4fad6
minor style check update
cameronlee314 b63e032
simplify terminology: rename Scheduling to Scheduled, rename KeySched…
cameronlee314 970830c
Merge branch 'master' into rename_timer
cameronlee314 e7abf9f
doc updates, SystemTimerScheduler renamed to EpochTimeScheduler
cameronlee314 0a57d43
Merge branch 'master' into rename_timer
cameronlee314 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
samza-api/src/main/java/org/apache/samza/operators/functions/ScheduledFunction.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| /* | ||
| * 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.samza.operators.functions; | ||
|
|
||
| import org.apache.samza.operators.Scheduler; | ||
|
|
||
| import java.util.Collection; | ||
|
|
||
|
|
||
| /** | ||
| * Allows scheduling a callback for a specific epoch-time. | ||
| * Key must be a unique identifier for its corresponding logic to execute, and is provided in the callback when the | ||
| * corresponding schedule time occurs. | ||
| * | ||
| * <p> | ||
| * Example of a {@link FlatMapFunction} with {@link ScheduledFunction}: | ||
| * <pre>{@code | ||
| * public class ExampleScheduledFn implements FlatMapFunction<String, String>, ScheduledFunction<String, String> { | ||
| * // for recurring callbacks, keep track of the scheduler from "schedule" | ||
| * private Scheduler scheduler; | ||
| * | ||
| * public void schedule(Scheduler scheduler) { | ||
| * // save the scheduler for recurring callbacks | ||
| * this.scheduler = scheduler; | ||
| * long time = System.currentTimeMillis() + 5000; // fire after 5 sec | ||
| * scheduler.schedule("do-delayed-logic", time); | ||
| * } | ||
| * public Collection<String> apply(String s) { | ||
| * ... | ||
| * } | ||
| * public Collection<String> onCallback(String key, long timestamp) { | ||
| * // do some logic for key "do-delayed-logic" | ||
| * ... | ||
| * // for recurring callbacks, call the saved scheduler again | ||
| * this.scheduler.schedule("example-process", System.currentTimeMillis() + 5000); | ||
| * } | ||
| * } | ||
| * }</pre> | ||
| * @param <K> type of the key | ||
| * @param <OM> type of the output | ||
| */ | ||
| public interface ScheduledFunction<K, OM> { | ||
| /** | ||
| * Allows scheduling the initial callback(s) and saving the {@code scheduler} for later use for recurring callbacks. | ||
| * @param scheduler used to specify the schedule time(s) and key(s) | ||
| */ | ||
| void schedule(Scheduler<K> scheduler); | ||
|
|
||
| /** | ||
| * Returns the output from the scheduling logic corresponding to the key that was triggered. | ||
| * @param key key corresponding to the callback that got invoked | ||
| * @param timestamp schedule time that was set for the callback for the key, in milliseconds since epoch | ||
| * @return {@link Collection} of output elements | ||
| */ | ||
| Collection<OM> onCallback(K key, long timestamp); | ||
| } | ||
65 changes: 0 additions & 65 deletions
65
samza-api/src/main/java/org/apache/samza/operators/functions/TimerFunction.java
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.