Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;

import javax.annotation.Nullable;

/**
Expand Down Expand Up @@ -746,9 +745,9 @@ public long getEncodedElementByteSize(KeyPrefix value, Coder.Context context)
*/
@AutoValue
public abstract static class Footer {
static final int LONG_BYTES = 8;
static final int FIXED_LENGTH = 3 * LONG_BYTES + 1;
static final byte VERSION = 2;
public static final int LONG_BYTES = 8;
public static final int FIXED_LENGTH = 3 * LONG_BYTES + 1;
public static final byte VERSION = 2;

public abstract byte getVersion();
public abstract long getIndexPosition();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.apache.beam.sdk.transforms.windowing.BoundedWindow;
import org.apache.beam.sdk.util.state.StateInternals;
import org.apache.beam.sdk.values.TupleTag;
import com.google.common.base.Supplier;

import java.io.IOException;
import java.util.Collection;
Expand Down Expand Up @@ -71,18 +70,27 @@ public T getOrCreateStepContext(String stepName, String transformName) {
final String finalTransformName = transformName;
return getOrCreateStepContext(
stepName,
new Supplier<T>() {
new CreateStepContextFunction<T>() {
@Override
public T get() {
public T create() {
return createStepContext(finalStepName, finalTransformName);
}
});
}

protected final T getOrCreateStepContext(String stepName, Supplier<T> createContextFunc) {
/**
* Factory method interface to create an execution context if none exists during
* {@link #getOrCreateStepContext(String, CreateStepContextFunction)}.
*/
protected interface CreateStepContextFunction<T extends ExecutionContext.StepContext> {
T create();
}

protected final T getOrCreateStepContext(String stepName,
CreateStepContextFunction<T> createContextFunc) {
T context = cachedStepContexts.get(stepName);
if (context == null) {
context = createContextFunc.get();
context = createContextFunc.create();
cachedStepContexts.put(stepName, context);
}

Expand Down