Skip to content

fix issue 1953#1962

Merged
ryanjbaxter merged 2 commits intospring-cloud:3.2.xfrom
wind57:fix-1953
Jul 31, 2025
Merged

fix issue 1953#1962
ryanjbaxter merged 2 commits intospring-cloud:3.2.xfrom
wind57:fix-1953

Conversation

@wind57
Copy link
Copy Markdown
Contributor

@wind57 wind57 commented Jul 29, 2025

No description provided.

Signed-off-by: wind57 <[email protected]>
}

@Bean(destroyMethod = "stop")
@Bean
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LeaderInitiator is declared like this:

LeaderInitiator implements SmartLifecycle

and already has :

	@Override
	public void stop() {
		if (isRunning()) {
			LOGGER.debug(() -> "Leader initiator stopping");
			scheduledExecutorService.shutdown();
			scheduledExecutorService = null;
			hostPodWatcher.stop();
			leaderRecordWatcher.stop();
			leadershipController.revoke();
			isRunning = false;
		}
	}

	@Override
	public void stop(Runnable callback) {
		stop();
		callback.run();
	}

The fact that we had its declaration as : @Bean(destroyMethod = "stop") would mean that the stop method is called twice, cause the issue

@ryanjbaxter ryanjbaxter merged commit 577dc93 into spring-cloud:3.2.x Jul 31, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

spring-cloud-kubernetes-fabric8-leader - NullPointerException on pod termination

3 participants