Sean-Walker0 opened a new pull request, #7789:
URL: https://github.com/apache/shenyu/pull/7789
Fixes #7775
## Modifications
`ApplicationStartListener` handled **every** `WebServerInitializedEvent`, so
when the actuator management server (namespace `"management"`) started on its
own port, the listener called `shenyuRunningModeService.start(host,
managementPort, contextPath)` a second time. In standalone mode this re-runs
the checker setup; in cluster mode it schedules an extra recurring election
task — both for a port that is not an Admin endpoint.
Events whose application context server namespace is `"management"` are now
skipped:
```java
if (event instanceof ServletWebServerInitializedEvent servletEvent
&&
"management".equals(servletEvent.getApplicationContext().getServerNamespace()))
{
return;
}
```
The main server event (no namespace / `"server"`) keeps the existing
behavior unchanged.
## Verifying this change
- [x] New `ApplicationStartListenerTest#testIgnoresManagementServerEvent` —
delivers a management-namespace `ServletWebServerInitializedEvent` and asserts
`shenyuRunningModeService.start` is never invoked for it. Red on the pre-fix
code (the service was started with the management port, matching the issue's
two-event reproduction), green after.
- [x] `./mvnw -pl shenyu-admin -am test -B
-Dtest=ApplicationStartListenerTest` — 4/4 green (3 pre-existing cases
unchanged), module checkstyle clean.
## Notes
- Behavior change: a second `start` call for the management port no longer
happens — that call had no valid purpose (the management server is a
side-channel, not another Admin instance).
- The issue notes a wrong advertised master port "has not been demonstrated
in a deployed environment" — this fix removes the double-start unconditionally,
without depending on event ordering.
- Orthogonality: no open PR modifies `ApplicationStartListener` (verified
against the file lists of all 106 open PRs).
Make sure that:
- [x] You have read the [contribution
guidelines](https://shenyu.apache.org/community/contributor-guide).
- [x] You submit test cases (unit or integration tests) that back your
changes.
- [x] Your local test passed `./mvnw clean install
-Dmaven.javadoc.skip=true` (module-scoped: `shenyu-admin` targeted test class +
checkstyle green; full-module suite left to CI as with the other admin PRs).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]