in src/main/java/com/amazonaws/services/kinesis/scaling/StreamScaler.java [162:181]
public ScalingOperationReport scaleDown(String streamName, double byPct, Integer minShards, Integer maxShards,
boolean waitForCompletion) throws Exception {
double scalePct = byPct;
if (scalePct < 0)
throw new Exception(streamName + ": Scaling Percent should be a positive number");
int currentSize = StreamScalingUtils.getOpenShardCount(kinesisClient, streamName);
if (currentSize == 1) {
throw new AlreadyOneShardException();
}
int newSize = Math.max(new Double(Math.ceil(currentSize - Math.max(currentSize * scalePct, 1))).intValue(), 1);
if (newSize > 0) {
return doResize(streamName, newSize, minShards, maxShards, waitForCompletion);
} else {
return null;
}
}