Removed Automatic Indents
This commit is contained in:
parent
03c78fd15e
commit
366d275447
10 changed files with 162 additions and 178 deletions
|
|
@ -20,7 +20,6 @@ import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.amazonaws.services.dynamodbv2.model.BillingMode;
|
import com.amazonaws.services.dynamodbv2.model.BillingMode;
|
||||||
import com.amazonaws.services.kinesis.leases.impl.LeaseCleanupManager;
|
|
||||||
import org.apache.commons.lang3.Validate;
|
import org.apache.commons.lang3.Validate;
|
||||||
|
|
||||||
import com.amazonaws.ClientConfiguration;
|
import com.amazonaws.ClientConfiguration;
|
||||||
|
|
@ -92,7 +91,7 @@ public class KinesisClientLibConfiguration {
|
||||||
public static final boolean DEFAULT_CLEANUP_LEASES_UPON_SHARDS_COMPLETION = true;
|
public static final boolean DEFAULT_CLEANUP_LEASES_UPON_SHARDS_COMPLETION = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interval to run lease cleanup thread in {@link LeaseCleanupManager}.
|
* Interval to run lease cleanup thread in {@link com.amazonaws.services.kinesis.leases.impl.LeaseCleanupManager}.
|
||||||
*/
|
*/
|
||||||
private static final long DEFAULT_LEASE_CLEANUP_INTERVAL_MILLIS = Duration.ofMinutes(1).toMillis();
|
private static final long DEFAULT_LEASE_CLEANUP_INTERVAL_MILLIS = Duration.ofMinutes(1).toMillis();
|
||||||
|
|
||||||
|
|
@ -628,7 +627,7 @@ public class KinesisClientLibConfiguration {
|
||||||
* @param billingMode The DDB Billing mode to set for lease table creation.
|
* @param billingMode The DDB Billing mode to set for lease table creation.
|
||||||
* @param recordsFetcherFactory Factory to create the records fetcher to retrieve data from Kinesis for a given shard.
|
* @param recordsFetcherFactory Factory to create the records fetcher to retrieve data from Kinesis for a given shard.
|
||||||
* @param leaseCleanupIntervalMillis Rate at which to run lease cleanup thread in
|
* @param leaseCleanupIntervalMillis Rate at which to run lease cleanup thread in
|
||||||
* {@link LeaseCleanupManager}
|
* {@link com.amazonaws.services.kinesis.leases.impl.LeaseCleanupManager}
|
||||||
* @param completedLeaseCleanupThresholdMillis Threshold in millis at which to check if there are any completed leases
|
* @param completedLeaseCleanupThresholdMillis Threshold in millis at which to check if there are any completed leases
|
||||||
* (leases for shards which have been closed as a result of a resharding operation) that need to be cleaned up.
|
* (leases for shards which have been closed as a result of a resharding operation) that need to be cleaned up.
|
||||||
* @param garbageLeaseCleanupThresholdMillis Threshold in millis at which to check if there are any garbage leases
|
* @param garbageLeaseCleanupThresholdMillis Threshold in millis at which to check if there are any garbage leases
|
||||||
|
|
@ -927,7 +926,7 @@ public class KinesisClientLibConfiguration {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Interval in millis at which to run lease cleanup thread in {@link LeaseCleanupManager}
|
* @return Interval in millis at which to run lease cleanup thread in {@link com.amazonaws.services.kinesis.leases.impl.LeaseCleanupManager}
|
||||||
*/
|
*/
|
||||||
public long leaseCleanupIntervalMillis() {
|
public long leaseCleanupIntervalMillis() {
|
||||||
return leaseCleanupIntervalMillis;
|
return leaseCleanupIntervalMillis;
|
||||||
|
|
@ -1624,7 +1623,7 @@ public class KinesisClientLibConfiguration {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param leaseCleanupIntervalMillis Rate at which to run lease cleanup thread in
|
* @param leaseCleanupIntervalMillis Rate at which to run lease cleanup thread in
|
||||||
* {@link LeaseCleanupManager}
|
* {@link com.amazonaws.services.kinesis.leases.impl.LeaseCleanupManager}
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public KinesisClientLibConfiguration withLeaseCleanupIntervalMillis(long leaseCleanupIntervalMillis) {
|
public KinesisClientLibConfiguration withLeaseCleanupIntervalMillis(long leaseCleanupIntervalMillis) {
|
||||||
|
|
|
||||||
|
|
@ -14,20 +14,6 @@
|
||||||
*/
|
*/
|
||||||
package com.amazonaws.services.kinesis.clientlibrary.lib.worker;
|
package com.amazonaws.services.kinesis.clientlibrary.lib.worker;
|
||||||
|
|
||||||
|
|
||||||
import com.amazonaws.services.kinesis.clientlibrary.exceptions.internal.BlockedOnParentShardException;
|
|
||||||
import com.amazonaws.services.kinesis.clientlibrary.interfaces.ICheckpoint;
|
|
||||||
import com.amazonaws.services.kinesis.clientlibrary.interfaces.v2.IRecordProcessor;
|
|
||||||
import com.amazonaws.services.kinesis.leases.impl.KinesisClientLease;
|
|
||||||
import com.amazonaws.services.kinesis.leases.impl.LeaseCleanupManager;
|
|
||||||
import com.amazonaws.services.kinesis.leases.interfaces.ILeaseManager;
|
|
||||||
import com.amazonaws.services.kinesis.metrics.interfaces.IMetricsFactory;
|
|
||||||
import com.amazonaws.services.kinesis.model.ChildShard;
|
|
||||||
import com.amazonaws.util.CollectionUtils;
|
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
@ -35,6 +21,21 @@ import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.RejectedExecutionException;
|
import java.util.concurrent.RejectedExecutionException;
|
||||||
|
|
||||||
|
import com.amazonaws.services.kinesis.leases.impl.LeaseCleanupManager;
|
||||||
|
import com.amazonaws.services.kinesis.model.ChildShard;
|
||||||
|
import com.amazonaws.util.CollectionUtils;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
|
import com.amazonaws.services.kinesis.clientlibrary.exceptions.internal.BlockedOnParentShardException;
|
||||||
|
import com.amazonaws.services.kinesis.clientlibrary.interfaces.ICheckpoint;
|
||||||
|
import com.amazonaws.services.kinesis.clientlibrary.interfaces.v2.IRecordProcessor;
|
||||||
|
import com.amazonaws.services.kinesis.leases.impl.KinesisClientLease;
|
||||||
|
import com.amazonaws.services.kinesis.leases.interfaces.ILeaseManager;
|
||||||
|
import com.amazonaws.services.kinesis.metrics.interfaces.IMetricsFactory;
|
||||||
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Responsible for consuming data records of a (specified) shard.
|
* Responsible for consuming data records of a (specified) shard.
|
||||||
* The instance should be shutdown when we lose the primary responsibility for a shard.
|
* The instance should be shutdown when we lose the primary responsibility for a shard.
|
||||||
|
|
@ -61,7 +62,7 @@ public class KinesisShardConsumer implements IShardConsumer{
|
||||||
private final long taskBackoffTimeMillis;
|
private final long taskBackoffTimeMillis;
|
||||||
private final boolean skipShardSyncAtWorkerInitializationIfLeasesExist;
|
private final boolean skipShardSyncAtWorkerInitializationIfLeasesExist;
|
||||||
|
|
||||||
//@Getter
|
@Getter
|
||||||
private final ShardSyncer shardSyncer;
|
private final ShardSyncer shardSyncer;
|
||||||
|
|
||||||
private ITask currentTask;
|
private ITask currentTask;
|
||||||
|
|
@ -69,24 +70,12 @@ public class KinesisShardConsumer implements IShardConsumer{
|
||||||
private Future<TaskResult> future;
|
private Future<TaskResult> future;
|
||||||
private ShardSyncStrategy shardSyncStrategy;
|
private ShardSyncStrategy shardSyncStrategy;
|
||||||
|
|
||||||
//@Getter
|
@Getter
|
||||||
private List<ChildShard> childShards;
|
private List<ChildShard> childShards;
|
||||||
|
|
||||||
//@Getter
|
@Getter
|
||||||
private final GetRecordsCache getRecordsCache;
|
private final GetRecordsCache getRecordsCache;
|
||||||
|
|
||||||
public List<ChildShard> getChildShards() {
|
|
||||||
return childShards;
|
|
||||||
}
|
|
||||||
|
|
||||||
public GetRecordsCache getGetRecordsCache() {
|
|
||||||
return getRecordsCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ShardSyncer getShardSyncer() {
|
|
||||||
return shardSyncer;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final GetRecordsRetrievalStrategy makeStrategy(IDataFetcher dataFetcher,
|
private static final GetRecordsRetrievalStrategy makeStrategy(IDataFetcher dataFetcher,
|
||||||
Optional<Integer> retryGetRecordsInSeconds,
|
Optional<Integer> retryGetRecordsInSeconds,
|
||||||
Optional<Integer> maxGetRecordsThreadPool,
|
Optional<Integer> maxGetRecordsThreadPool,
|
||||||
|
|
@ -382,10 +371,6 @@ public class KinesisShardConsumer implements IShardConsumer{
|
||||||
return skipShardSyncAtWorkerInitializationIfLeasesExist;
|
return skipShardSyncAtWorkerInitializationIfLeasesExist;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public enum TaskOutcome {
|
|
||||||
SUCCESSFUL, END_OF_SHARD, NOT_COMPLETE, FAILURE, LEASE_NOT_FOUND
|
|
||||||
}*/
|
|
||||||
|
|
||||||
private TaskOutcome determineTaskOutcome() {
|
private TaskOutcome determineTaskOutcome() {
|
||||||
try {
|
try {
|
||||||
TaskResult result = future.get();
|
TaskResult result = future.get();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue