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/11/23 06:52:08 UTC
[12/50] incubator-beam git commit: Restore StateContexts.windowOnly
for temporary compatibility
Restore StateContexts.windowOnly for temporary compatibility
Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/73692b80
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/73692b80
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/73692b80
Branch: refs/heads/gearpump-runner
Commit: 73692b808aa4e0d85c6e20eb19a1bf4a4355a5c1
Parents: 2a7169b
Author: Kenneth Knowles <kl...@google.com>
Authored: Fri Nov 18 14:40:59 2016 -0800
Committer: Kenneth Knowles <kl...@google.com>
Committed: Fri Nov 18 14:59:41 2016 -0800
----------------------------------------------------------------------
.../beam/sdk/util/state/StateContexts.java | 41 +++++++++++++++-----
1 file changed, 32 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/73692b80/sdks/java/core/src/main/java/org/apache/beam/sdk/util/state/StateContexts.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/state/StateContexts.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/state/StateContexts.java
index 858d6fe..1d6e949 100644
--- a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/state/StateContexts.java
+++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/state/StateContexts.java
@@ -42,22 +42,45 @@ public class StateContexts {
@Override
public BoundedWindow window() {
throw new IllegalArgumentException("cannot call window() in a null context");
- }};
+ }
+ };
- /**
- * Returns a fake {@link StateContext}.
- */
+ /** Returns a fake {@link StateContext}. */
@SuppressWarnings("unchecked")
public static <W extends BoundedWindow> StateContext<W> nullContext() {
return (StateContext<W>) NULL_CONTEXT;
}
/**
- * Deprecated, do not use.
- *
- * <p>This exists only for temporary compatibility with Dataflow worker and should be deleted
- * once a worker image is released that uses runners-core build after
- * https://github.com/apache/incubator-beam/pull/1353.
+ * @deprecated This exists only for temporary compatibility with Dataflow worker and should be
+ * deleted once a worker image is released that uses runners-core build after
+ * https://github.com/apache/incubator-beam/pull/1353.
+ */
+ @Deprecated
+ public static <W extends BoundedWindow> StateContext<W> windowOnly(final W window) {
+ return new StateContext<W>() {
+ @Override
+ public PipelineOptions getPipelineOptions() {
+ throw new IllegalArgumentException(
+ "cannot call getPipelineOptions() in a window only context");
+ }
+
+ @Override
+ public <T> T sideInput(PCollectionView<T> view) {
+ throw new IllegalArgumentException("cannot call sideInput() in a window only context");
+ }
+
+ @Override
+ public W window() {
+ return window;
+ }
+ };
+ }
+
+ /**
+ * @deprecated This exists only for temporary compatibility with Dataflow worker and should be
+ * deleted once a worker image is released that uses runners-core build after
+ * https://github.com/apache/incubator-beam/pull/1353.
*/
@Deprecated
public static <W extends BoundedWindow> StateContext<W> createFromComponents(