hengyuss opened a new pull request, #11:
URL: https://github.com/apache/shenyu-client-java/pull/11
<!-- Describe your PR here; e.g. Fixes #issueNo -->
<!--
Thank you for proposing a pull request. This template will guide you through
the essential steps necessary for a pull request.
-->
## What & Why
## What & Why
Attach host hardware info (arch, OS, CPU count, total memory) . Probed via
OSHI
6.10.0 + JDK `OperatingSystemMXBean`, JSON-attached to
`URIRegisterDTO.instanceInfo`.
## Java 8 Compatibility Adjustments to `SystemInfoUtils`
`SystemInfoUtils` was copied from the main `apache/shenyu` repo, where it
lives in `shenyu-common` and targets JDK 17. To make it compile under
Java 8 in `shenyu-client-java`, the following changes were necessary:
- **Package**: moved from `org.apache.shenyu.common.utils` to
`org.apache.shenyu.client.core.utils` — the `common` module is not
part of `shenyu-client-java`.
- **Exception**: replaced `ShenyuException` (defined in `shenyu-common`,
unavailable here) with a standard `RuntimeException` carrying the
original cause, matching the existing pattern in `AesUtils` /
`GsonUtils` / `HttpClientRegisterRepository`.
- **Constants**: removed `import static Constants.*` (also from
`shenyu-common`) and declared local `String` constants (`"arch"`,
`"operatingSystem"`, etc.) consistent with the naming already used
for `availableProcessors` / `totalMemorySizeGB`.
- **Map construction**: replaced `Map.of(...)` (Java 9+) with
`HashMap` to stay Java 8 compatible.
- **Memory source**: switched from `osBean.getTotalMemorySize()` to
`systemInfo.getHardware().getMemory().getTotal()` (OSHI), keeping all
hardware probing behind one library and avoiding JDK-internal API
divergence across JVM vendors.
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`.
--
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]