Source:
<code>private void initialize() { workerStateChangeListener.onWorkerStateChange(WorkerStateChangeListener.WorkerState.INITIALIZING); boolean isDone = false; Exception lastException = null; for (int i = 0; (!isDone) && (i < MAX_INITIALIZATION_ATTEMPTS); i++) { try { LOG.info("Initialization attempt " + (i + 1)); LOG.info("Initializing LeaseCoordinator"); leaseCoordinator.initialize(); TaskResult result = null; if (!skipShardSyncAtWorkerInitializationIfLeasesExist || leaseCoordinator.getLeaseManager().isLeaseTableEmpty()) { LOG.info("Syncing Kinesis shard info"); ShardSyncTask shardSyncTask = new ShardSyncTask(streamConfig.getStreamProxy(), leaseCoordinator.getLeaseManager(), initialPosition, cleanupLeasesUponShardCompletion, config.shouldIgnoreUnexpectedChildShards(), 0L, shardSyncer); result = new MetricsCollectingTaskDecorator(shardSyncTask, metricsFactory).call(); } else { LOG.info("Skipping shard sync per config setting (and lease table is not empty)"); } if (result == null || result.getException() == null) { if (!leaseCoordinator.isRunning()) { LOG.info("Starting LeaseCoordinator"); leaseCoordinator.start(); } else { LOG.info("LeaseCoordinator is already running. No need to start it."); } shardSyncStrategy.onWorkerInitialization(); isDone = true; } else { lastException = result.getException(); } } catch (LeasingException e) { LOG.error("Caught exception when initializing LeaseCoordinator", e); lastException = e; } catch (Exception e) { <START> LOG.error("Caught exception when initializing worker", e); <END> lastException = e; } try { Thread.sleep(parentShardPollIntervalMillis); } catch (InterruptedException e) { LOG.debug("Sleep interrupted while initializing worker."); } } if (!isDone) { throw new RuntimeException(lastException); } workerStateChangeListener.onWorkerStateChange(WorkerStateChangeListener.WorkerState.STARTED); }</code><technical_language>change logging behavior here. This spitting errors for retry attempts. remove this change</technical_language>

Target:
private void initialize() { workerStateChangeListener.onWorkerStateChange(WorkerStateChangeListener.WorkerState.INITIALIZING); boolean isDone = false; Exception lastException = null; for (int i = 0; (!isDone) && (i < MAX_INITIALIZATION_ATTEMPTS); i++) { try { LOG.info("Initialization attempt " + (i + 1)); LOG.info("Initializing LeaseCoordinator"); leaseCoordinator.initialize(); TaskResult result = null; if (!skipShardSyncAtWorkerInitializationIfLeasesExist || leaseCoordinator.getLeaseManager().isLeaseTableEmpty()) { LOG.info("Syncing Kinesis shard info"); ShardSyncTask shardSyncTask = new ShardSyncTask(streamConfig.getStreamProxy(), leaseCoordinator.getLeaseManager(), initialPosition, cleanupLeasesUponShardCompletion, config.shouldIgnoreUnexpectedChildShards(), 0L, shardSyncer); result = new MetricsCollectingTaskDecorator(shardSyncTask, metricsFactory).call(); } else { LOG.info("Skipping shard sync per config setting (and lease table is not empty)"); } if (result == null || result.getException() == null) { if (!leaseCoordinator.isRunning()) { LOG.info("Starting LeaseCoordinator"); leaseCoordinator.start(); } else { LOG.info("LeaseCoordinator is already running. No need to start it."); } shardSyncStrategy.onWorkerInitialization(); isDone = true; } else { lastException = result.getException(); } } catch (LeasingException e) { LOG.error("Caught exception when initializing LeaseCoordinator", e); lastException = e; } catch (Exception e) { lastException = e; } try { Thread.sleep(parentShardPollIntervalMillis); } catch (InterruptedException e) { LOG.debug("Sleep interrupted while initializing worker."); } } if (!isDone) { throw new RuntimeException(lastException); } workerStateChangeListener.onWorkerStateChange(WorkerStateChangeListener.WorkerState.STARTED); }