From 9ad65ee4868781837b2e30aa24fd82834b2039b3 Mon Sep 17 00:00:00 2001 From: Ashwin Giridharan Date: Thu, 20 Feb 2020 00:24:09 -0800 Subject: [PATCH] Optional bug fix --- .../java/software/amazon/kinesis/coordinator/Scheduler.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/amazon-kinesis-client/src/main/java/software/amazon/kinesis/coordinator/Scheduler.java b/amazon-kinesis-client/src/main/java/software/amazon/kinesis/coordinator/Scheduler.java index 9ccf5df5..0ba40d81 100644 --- a/amazon-kinesis-client/src/main/java/software/amazon/kinesis/coordinator/Scheduler.java +++ b/amazon-kinesis-client/src/main/java/software/amazon/kinesis/coordinator/Scheduler.java @@ -367,7 +367,7 @@ public class Scheduler implements Runnable { for (ShardInfo completedShard : completedShards) { final String streamName = completedShard.streamName() - .orElse(appStreamTracker.map(mst -> null, sc -> sc.streamName())); + .orElseGet(() -> appStreamTracker.map(mst -> null, sc -> sc.streamName())); Validate.notEmpty(streamName, "Stream name should not be null"); if (createOrGetShardSyncTaskManager(streamName).syncShardAndLeaseInfo()) { log.info("Found completed shard, initiated new ShardSyncTak for " + completedShard.toString()); @@ -640,7 +640,7 @@ public class Scheduler implements Runnable { checkpoint); // The only case where streamName is not available will be when multistreamtracker not set. In this case, // get the default stream name for the single stream application. - final String streamName = shardInfo.streamName().orElse(appStreamTracker.map(mst -> null, sc -> sc.streamName())); + final String streamName = shardInfo.streamName().orElseGet(() -> appStreamTracker.map(mst -> null, sc -> sc.streamName())); Validate.notEmpty(streamName, "StreamName should not be empty"); // Irrespective of single stream app or multi stream app, streamConfig should always be available. // TODO: Halo : if not available, construct a default config ?