-
Notifications
You must be signed in to change notification settings - Fork 466
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introducing HierarchicalShardSyncer inorder to run multiple Scheduler…
…s in a JVM (#395) * Run multiple instance of scheduler on one JVM * handling creation of shardSyncer in DynamoDBLeaseManagementFactory and LeaseManagementConfig * remove multi-threading unit test and do some small refactorings * refectoring * deprecate ShardSyncer and use HierarchichalShardSyncer instead; change the order for metricsFactory and HierarchichalShardSyncer in ShardConsumerArgument * fix typos and use mock object of shardSyncer * delete improper comments * fix comments * remove duplicated comments
- Loading branch information
1 parent
854e316
commit 14c6829
Showing
14 changed files
with
237 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...n-kinesis-client/src/main/java/software/amazon/kinesis/leases/exceptions/ShardSyncer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package software.amazon.kinesis.leases.exceptions; | ||
|
||
import lombok.NonNull; | ||
import software.amazon.kinesis.common.InitialPositionInStreamExtended; | ||
import software.amazon.kinesis.exceptions.internal.KinesisClientLibIOException; | ||
import software.amazon.kinesis.leases.HierarchicalShardSyncer; | ||
import software.amazon.kinesis.leases.LeaseRefresher; | ||
import software.amazon.kinesis.leases.ShardDetector; | ||
import software.amazon.kinesis.metrics.MetricsScope; | ||
|
||
/** | ||
* Helper class to sync leases with shards of the Kinesis stream. | ||
* It will create new leases/activities when it discovers new Kinesis shards (bootstrap/resharding). | ||
* It deletes leases for shards that have been trimmed from Kinesis, or if we've completed processing it | ||
* and begun processing it's child shards. | ||
* | ||
* <p>NOTE: This class is deprecated and will be removed in a future release.</p> | ||
*/ | ||
@Deprecated | ||
public class ShardSyncer { | ||
private static final HierarchicalShardSyncer HIERARCHICAL_SHARD_SYNCER = new HierarchicalShardSyncer(); | ||
|
||
/** | ||
* <p>NOTE: This method is deprecated and will be removed in a future release.</p> | ||
* | ||
* @param shardDetector | ||
* @param leaseRefresher | ||
* @param initialPosition | ||
* @param cleanupLeasesOfCompletedShards | ||
* @param ignoreUnexpectedChildShards | ||
* @param scope | ||
* @throws DependencyException | ||
* @throws InvalidStateException | ||
* @throws ProvisionedThroughputException | ||
* @throws KinesisClientLibIOException | ||
*/ | ||
@Deprecated | ||
public static synchronized void checkAndCreateLeasesForNewShards(@NonNull final ShardDetector shardDetector, | ||
final LeaseRefresher leaseRefresher, final InitialPositionInStreamExtended initialPosition, | ||
final boolean cleanupLeasesOfCompletedShards, final boolean ignoreUnexpectedChildShards, | ||
final MetricsScope scope) throws DependencyException, InvalidStateException, ProvisionedThroughputException, | ||
KinesisClientLibIOException { | ||
HIERARCHICAL_SHARD_SYNCER.checkAndCreateLeaseForNewShards(shardDetector, leaseRefresher, initialPosition, | ||
cleanupLeasesOfCompletedShards, ignoreUnexpectedChildShards, scope); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.