Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

W-11492245: Fix CheckPointMgr null check for cjclient as Kinesis cons… #692

Merged
merged 1 commit into from
Jul 24, 2023
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 @@ -61,7 +61,7 @@ public KinesisConsumer(MetricRegistry metricRegistry, PointProcessor pointProces
this.kinesisStreamName = kinesisStreamName;
this.kinesisApplicationName = kinesisApplicationName;
this.kinesisConfig = kinesisConfig;
this.checkPointMgr = Preconditions.checkNotNull(checkPointMgr);
this.checkPointMgr = checkPointMgr;
this.noOfRestarts = noOfRestarts;
this.kinesisConsumerRegion = kinesisConsumerRegion;
log.info("Kinesis consumer started");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder;
import com.demandware.carbonj.service.accumulator.Accumulator;
import com.demandware.carbonj.service.accumulator.cfgAccumulator;
import com.demandware.carbonj.service.engine.*;
import com.demandware.carbonj.service.engine.CheckPointMgr;
import com.demandware.carbonj.service.engine.DynamoDbCheckPointMgr;
import com.demandware.carbonj.service.engine.FileCheckPointMgr;
import com.demandware.carbonj.service.engine.KinesisConfig;
import com.demandware.carbonj.service.engine.cfgCarbonJ;
import com.demandware.carbonj.service.engine.cfgKinesis;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -47,10 +52,13 @@ CheckPointMgr<Date> checkPointMgr(ScheduledExecutorService s, KinesisConfig kine
@Autowired( required = false ) @Qualifier( "accumulator" ) Accumulator accu )
throws Exception
{
if ( !kinesisConfig.isKinesisConsumerEnabled() || accu == null )
if (!kinesisConfig.isKinesisConsumerEnabled()) {
log.warn("CheckPointMgr is disabled because kinesis consumer is disabled");
return null;
}
if (accu == null)
{
log.debug( "CheckPointMgr is disabled because kinesis consumer is disabled or accumulator is null: Kinesis"
+ " consumer: {}, Accumulator: {}", kinesisConfig.isKinesisConsumerEnabled(), accu );
log.warn("CheckPointMgr is disabled because accumulator is null");
return null;
}

Expand Down Expand Up @@ -84,4 +92,4 @@ CheckPointMgr<Date> checkPointMgr(ScheduledExecutorService s, KinesisConfig kine
}, 120, 60, TimeUnit.SECONDS );
return checkPointMgr;
}
}
}