Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IWorkerHook default start method calls its self #7947

Open
dpv91788 opened this issue Jan 31, 2025 · 0 comments
Open

IWorkerHook default start method calls its self #7947

dpv91788 opened this issue Jan 31, 2025 · 0 comments

Comments

@dpv91788
Copy link

In the IWorkerHook there is a default method

default void start(Map<String, Object> topoConf, WorkerUserContext context) {
        start(topoConf, context);
}

That ends up calling its self. I think the intention was to have it default to calling the deprecated method

default void start(Map<String, Object> topoConf, WorkerTopologyContext context) {
        // NOOP
}

In order for that to work I beleive the first default method needs to be changed to:

default void start(Map<String, Object> topoConf, WorkerUserContext context) {
        start(topoConf, (WorkerTopologyContext)context);
}

If you write a test for example like

	@Test
	void testWorkerHook(@Mock WorkerUserContext workerUContext) {
		IWorkerHook wHook = new IWorkerHook() {			
			private static final long serialVersionUID = 3766266493839497755L;

			@Override
			public void shutdown() {}
		};
		
		wHook.start(Collections.emptyMap(), workerUContext);
	}

It will result in a java.lang.StackOverflowError

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

No branches or pull requests

1 participant