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 e621376c..c3e7805b 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 @@ -763,9 +763,12 @@ public class Scheduler implements Runnable { // Stop accepting new leases. Once we do this we can be sure that // no more leases will be acquired. // - leaseCoordinator.stopLeaseTaker(); + Collection leases = Collections.emptyList(); + if (leaseCoordinator != null) { + leaseCoordinator.stopLeaseTaker(); + leases = leaseCoordinator.getAssignments(); + } - Collection leases = leaseCoordinator.getAssignments(); if (leases == null || leases.isEmpty()) { // // If there are no leases notification is already completed, but we still need to shutdown the worker.