-
Notifications
You must be signed in to change notification settings - Fork 135
Deprecate legacy Chronicle-Core APIs, harden IO/process utilities, and align tests with new init/analytics semantics #835
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
Open
peter-lawrey
wants to merge
20
commits into
adv/javadoc
Choose a base branch
from
adv/develop
base: adv/javadoc
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Conflicts: # README.adoc # src/main/docs/system-architecture.adoc
james-mcsherry
approved these changes
Nov 20, 2025
…umentation for assertion utilities and benchmarks
…ExceptionTest for cleaner test code
…entLoop classes for cleaner code
…ng in IntegrationTestUtil; add null check in RouterRejectPropagationTests
|
# Conflicts: # src/main/java/net/openhft/chronicle/core/internal/util/RangeUtil.java # src/main/java/net/openhft/chronicle/core/io/Wget.java # src/test/java/net/openhft/chronicle/core/UnsafePingPointMain.java # src/test/java/net/openhft/chronicle/core/cleaner/CleanerServiceFallbackTest.java # src/test/java/net/openhft/chronicle/core/onoes/ChainedExceptionHandlerTest.java # src/test/java/net/openhft/chronicle/core/util/AbstractInvocationHandlerTest.java # src/test/java/net/openhft/chronicle/core/util/CompilerUtilsTest.java
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.



Build and dependency management
Bump third-party BOM
net.openhft:third-party-bomfrom3.27ea5→3.27ea7, pulling in the latest curated dependency set for Chronicle-Core.JetBrains annotations exposed at compile scope
org.jetbrains:annotationsnow has<scope>compile</scope>so downstream consumers see the nullability annotations on Chronicle-Core APIs without having to add the dependency themselves.Chronicle init & system properties
ChronicleInit no-op hook removed from Jvm.init()
ChronicleInit.init()(a no-op extension hook) is removed fromJvm.init(). Static initialisation now relies solely onChronicleInit’s static block andChronicleInit.postInit(), which are still invoked fromJvm’s static initialiser.New test harness (
SystemPropertiesPrimingRunnable,SystemPropertiesProbeMain, extendedChronicleInitTest) verifies:chronicle.init.runnablecan primeJvm.SYSTEM_PROPERTIESbeforeJvmloadssystem.properties.chronicle.postinit.runnablecan adjust runtime flags (for examplejvm.resource.tracing) and that misconfiguration leads to explicit non-zero exit codes.Bootstrap/Jvm construction semantics tightened
Bootstrapgets an explicitly deprecated public constructor (@Deprecated(/* make private in 2026 */)), signalling future encapsulation while preserving current behaviour.ChronicleInit’s constructor is moved below the static block, but remains private and purely for non-instantiability.IO, filesystem and process handling
More robust file IO using NIO APIs
Jvm.loadSystemPropertiesnow usesFiles.newInputStream(file.toPath())instead ofnew FileInputStream, aligning with NIO and centralising resource handling.IOTools.writeFilenow usesFiles.newOutputStream(Paths.get(filename)), keeping semantics (including.gzhandling) while improving error propagation.LicenceCheckreads<product>.expiry-dateexplicitly as UTF-8 (new String(..., UTF_8)), removing platform-default charset ambiguities for licence expiry checks.Tmp/target directory creation with warnings instead of silent failure
OS.findTmp0()andOS.findTarget0()now:mkdir()/mkdirs()succeed; if not, they log a warning viaJvm.warn().on(OS.class, ...)instead of silently continuing with a potentially unusable path."tmp"or${java.io.tmpdir}/targetbut emit a warning if directory creation fails.PID and process utilities hardened
OS.getProcessId0()now usesThreadLocalRandominstead ofSecureRandomwhen falling back to a random PID, avoiding blocking entropy sources in constrained environments.Jvm.isProcessAlive0(long pid, String command):StandardCharsets.UTF_8when reading subprocess output.Processis always destroyed in afinallyblock.OS.run(String... cmds):finallyblock.Memory mapping and unmapping diagnostics
OS.unmap(long address, long size, int pageSize)now captures the native return code fromunmapp0and, when debug logging is enabled, logs non-zero results together with the affected address.IOException.Signal handling, logging and exception infrastructure
SLF4J parameterised logging upgrades
Several string-concatenation logging calls have been converted to SLF4J’s
{}style, for example:Jvmstartup logging:"Chronicle core loaded from {}"instead ofString.format(...).CpuClasswarnings whenwmic/sysctlfail:"process {} returned {}"and"process {} waitFor threw "with the command and return code injected.ChainedExceptionHandlernow logs"Unable to call with message {}"instead of string concatenation.ExceptionKey message fallback semantics
ExceptionKey.message()now returnsthrowable.toString()when the stored message isnullor empty, ensuring the key always has a meaningful description even when callers log anullmessage.Direct buffer and IO utilities
DirectBufferUtil.addressOrThrow(ByteBuffer):instanceof DirectBuffer, throwing aClassCastExceptionwith a descriptive message if invoked on a non-direct buffer.IllegalAccessErroror other lower-level errors; behaviour is now clearer and more predictable.Wget.fetch():Readercreated around the limited stream is closed via try-with-resources.Wget.url(String, StringBuilder)and builder customisation methods for tests, while keeping runtime behaviour unchanged.LimitedInputStreamis unchanged; tests now assert its semantics more explicitly.LimitedInputStream:IllegalArgumentExceptionat construction for negative size limits."Size limit exceeded"IOExceptionif underlying data remains.Core utilities and behaviour fixes
GenericReflection.erase(Type)
Now:
ParameterizedTypeby erasing to the raw type (unchanged).Classinstances.UnsupportedOperationExceptionfor unsupportedTypeflavours instead of a potentially unsafe cast; tests cover realistic usages and no production callers should hit the new exception path.Maths.divideRoundUp(long, long)
ArithmeticExceptionon zero divisor). The test is corrected to actually assert the exception rather than calling the method unguarded.ObjectUtils / StringUtils small semantic tweaks
ObjectUtils.getAllInterfaces(Object)now usestoArray(new Class<?>[0])instead of pre-sizing fromsize(), which is semantically equivalent but favours the recommended idiom.ObjectUtils.requireNonNullis centralised and tested; semantics unchanged (still uses theo.getClass()trick).StringUtils.newStringFromBytes(byte[])now usesnew String(bytes, ISO_8859_1)when one-byte-per-char is not available, and anew String(new byte[0], ISO_8859_1)placeholder for the reflection path (behaviourally equivalent, but avoids the “redundant String constructor” pattern).StringUtils.extractBytes(String)and tests now consistently useISO_8859_1/UTF-8 via constants instead of implicit platform defaults.Licence/expiry handling
LicenceCheck.licenceExpiryreads*.expiry-dateusing UTF-8, making licence expiry checks deterministic across locales/filesystems.Deprecations and future removals
This PR adds deprecation markers (with target removal years) on a set of legacy or test-only APIs to make the roadmap explicit while preserving binary compatibility:
Runtime/developer APIs (2027 unless noted):
Jvm:isJava12Plus()(test-only)isFlightRecorder()lockWithStack(ReentrantLock)usedDirectMemory(),usedNativeMemory()(test-only)setThreadLocalExceptionHandlers(...)overload with 6 argsareOptionalSafepointsEnabled()(test-only)stackTraceEndsWith(String, int)classMetrics(Class<?>)(test-only)userHome()OS:findDir(String),getIPAddress(),getUserDir(),getPidMax(),map(FileChannel, MapMode, start, size),spaceUsed(String),userDir()– marked for eventual removal or consolidation into newer APIs; tests use them explicitly.UnsafeMemory:IS_LITTLE_ENDIANconstant and several static helpers (putInt(byte[],...),unsafeStoreFence(),unsafePutLong(...),unsafePutInt(...),unsafePutByte(...)) – retained for compatibility, signposted for removal or replacement with theMemoryinterface.Maths.roundNup(double, int)– deprecated in favour of the more predictableroundN.ForceInlineandHotMethodannotations – deprecated, retained only for legacy benchmark tooling.RangeUtiland many assertion/invariant helpers (Ints.assertIfEnabled,Ints.nonNegative, etc.) – visible deprecations ahead of API simplification.AbstractCloseable.gcAndWaitForCloseablesToClose(),AbstractCloseableReferenceCounted.throwExceptionIfClosedInSetter()– still wired through but marked as legacy.LimitedInputStream– now explicitly deprecated and documented as test-only; public callers should use higher-level APIs (e.g.Wgetor caller-specific wrappers).ThreadLocalHelper.getSTL(...),ClassMetrics,CompilerUtils,RecordingHistogram.typical(),SerializableUpdaterWithArg,StringUtils.set(...),StringUtils.newStringFromBytes(...),StringUtils.toTitleCase,StringUtils.parseLong(...),MaxBytes– flagged as test-only or legacy support and scheduled for removal.Chronicle cooler/cpu utilities:
CoolerTesterandCpuCoolersare annotated with TODOs to move into Chronicle-Test-Framework in 2026 and include a sentinel check on the blackhole to catch misuse.All deprecations preserve current behaviour; no methods have been removed in this PR.
Non-functional changes
Code quality and style
Switch more tests and utilities to UTF-8 / ISO-8859-1 explicitly (tests updated accordingly).
Replace ad-hoc
fail()/try/catchpatterns withassertThrows(...)and JUnit 5 assertions where appropriate.Remove unused fields and dead code (e.g. inner classes that existed only for tests or experimental code), and drop an unused jitter harness (
LongPingPongMain).Consistently move static holder classes to the bottom of files and make their constructors private.
Improve test robustness around:
BackgroundResourceReleaser,CleaningThreadLocal,ScopedThreadLocal, andUniqueMicroTimeProvider,Logging and diagnostics
ReferenceCountedUtilswhen tracing is enabled and ensure leak diagnostics include suppressedStackTracesnapshots.