Skip to content

Commit

Permalink
rename member, use specific interface
Browse files Browse the repository at this point in the history
  • Loading branch information
scwhittle committed Feb 13, 2025
1 parent 755170c commit 43c67cc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 3 additions & 3 deletions sdks/java/core/src/main/java/org/apache/beam/sdk/io/Read.java
Original file line number Diff line number Diff line change
Expand Up @@ -483,13 +483,13 @@ static class UnboundedSourceAsSDFWrapperFn<OutputT, CheckpointT extends Checkpoi
private final Coder<CheckpointT> checkpointCoder;
private final MemoizingPerInstantiationSerializableSupplier<
Cache<Object, UnboundedReader<OutputT>>>
cachedReaders;
readerCacheSupplier;
private @Nullable Coder<UnboundedSourceRestriction<OutputT, CheckpointT>> restrictionCoder;

@VisibleForTesting
UnboundedSourceAsSDFWrapperFn(Coder<CheckpointT> checkpointCoder) {
this.checkpointCoder = checkpointCoder;
cachedReaders =
readerCacheSupplier =
new MemoizingPerInstantiationSerializableSupplier<>(
() ->
CacheBuilder.newBuilder()
Expand Down Expand Up @@ -561,7 +561,7 @@ public void splitRestriction(
Coder<UnboundedSourceRestriction<OutputT, CheckpointT>> restrictionCoder =
checkStateNotNull(this.restrictionCoder);
Cache<Object, UnboundedReader<OutputT>> cachedReaders =
checkStateNotNull(this.cachedReaders.get());
checkStateNotNull(this.readerCacheSupplier.get());
return new UnboundedSourceAsSDFRestrictionTracker<>(
restriction, pipelineOptions, cachedReaders, restrictionCoder);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
*/
package org.apache.beam.sdk.util;

import java.io.Serializable;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Supplier;
import javax.annotation.Nullable;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.NonNull;
Expand All @@ -37,7 +35,7 @@
* using the same DoFn. This differs from a static variable which would be shared across all
* instances of the DoFn and a non-static variable which is per instance.
*/
public class MemoizingPerInstantiationSerializableSupplier<T> implements Serializable, Supplier<T> {
public class MemoizingPerInstantiationSerializableSupplier<T> implements SerializableSupplier<T> {
private static final AtomicInteger idGenerator = new AtomicInteger();
private final int id;

Expand Down

0 comments on commit 43c67cc

Please sign in to comment.