You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by ke...@apache.org on 2016/12/08 03:30:14 UTC

[4/5] incubator-beam git commit: Support OnTimerContext in ByteBuddyDoFnInvokerFactory

Support OnTimerContext in ByteBuddyDoFnInvokerFactory


Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/a26ed134
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/a26ed134
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/a26ed134

Branch: refs/heads/master
Commit: a26ed134bc57970ed83156f93d660a637465a9d6
Parents: 2883062
Author: Kenneth Knowles <kl...@google.com>
Authored: Tue Dec 6 20:19:32 2016 -0800
Committer: Kenneth Knowles <kl...@google.com>
Committed: Wed Dec 7 19:22:44 2016 -0800

----------------------------------------------------------------------
 .../sdk/transforms/reflect/ByteBuddyDoFnInvokerFactory.java   | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/a26ed134/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/reflect/ByteBuddyDoFnInvokerFactory.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/reflect/ByteBuddyDoFnInvokerFactory.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/reflect/ByteBuddyDoFnInvokerFactory.java
index 3480603..01ddd86 100644
--- a/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/reflect/ByteBuddyDoFnInvokerFactory.java
+++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/reflect/ByteBuddyDoFnInvokerFactory.java
@@ -85,6 +85,7 @@ public class ByteBuddyDoFnInvokerFactory implements DoFnInvokerFactory {
 
   public static final String CONTEXT_PARAMETER_METHOD = "context";
   public static final String PROCESS_CONTEXT_PARAMETER_METHOD = "processContext";
+  public static final String ON_TIMER_CONTEXT_PARAMETER_METHOD = "onTimerContext";
   public static final String WINDOW_PARAMETER_METHOD = "window";
   public static final String INPUT_PROVIDER_PARAMETER_METHOD = "inputProvider";
   public static final String OUTPUT_RECEIVER_PARAMETER_METHOD = "outputReceiver";
@@ -556,7 +557,11 @@ public class ByteBuddyDoFnInvokerFactory implements DoFnInvokerFactory {
 
           @Override
           public StackManipulation dispatch(OnTimerContextParameter p) {
-            throw new UnsupportedOperationException("OnTimerContext is not yet supported.");
+            return new StackManipulation.Compound(
+                pushDelegate,
+                MethodInvocation.invoke(
+                    getExtraContextFactoryMethodDescription(
+                        ON_TIMER_CONTEXT_PARAMETER_METHOD, DoFn.class)));
           }
 
           @Override