refactor/eliminate finalization#823
Merged
joe-chacko merged 11 commits intoJun 25, 2026
Merged
Conversation
c2f1325 to
c378a21
Compare
- Removed finalize() from ClientManager (assertions for destroyed state and empty collections) - Removed finalize() from InitialServiceManager (assertion for destroy_ flag) - Removed finalize() from ORBInstance (assertion for destroyCalled flag) - Removed finalize() from ServerManager (assertions for destroy_ flag and empty collections) - Removed finalize() from ThreadPool (assertion for destroy_ flag) - Removed finalize() from ValueFactoryManager (assertion for destroy_ flag) - Removed finalize() from POA_impl (assertion for destroyed state) - Removed finalize() from PoaCurrentImpl (empty finalize method) - Lines removed: 40 Co-authored-by-AI: IBM Bob 1.0.4
- Created YokoCleaner class using PhantomReference + ReferenceQueue - Returns SimplyCloseable for manual cleanup triggering - Uses LazyReference internally for idempotent, thread-safe cleanup - Use LazyReference<Void> to defer thread creation until first register() call - All threads calling close() block until cleanup completes - Exceptions in cleanup actions are caught and logged - Added comprehensive test suite with 10 passing tests - Lines added: 382 Co-authored-by-AI: IBM Bob 1.0.4
c378a21 to
53adedf
Compare
joe-chacko
approved these changes
Jun 24, 2026
Phase 3 of finalization refactoring: Refactor DowncallStub to use YokoCleaner for automatic resource cleanup instead of finalize(). Key changes: - Added CleanupState static nested class using LazyReference pattern for thread-safe lazy initialization of clientProfilePairs - Changed clientProfilePairs_ from Vector to LazyReference<Vector> - Removed destroy() and finalize() methods - Updated all references to use LazyReference.get() - Cleanup action releases clients via ClientManager when object becomes phantom reachable - Substantive lines added: 71, lines removed: 63 Benefits: - Eliminates finalizer overhead and unpredictability - Thread-safe lazy initialization via LazyReference - Explicit cleanup via SimplyCloseable when needed - Automatic cleanup on garbage collection via YokoCleaner Tests: All 91,844 yoko-core tests pass, test-osgi tests pass
…Starter and GIOPServer Phase 3 of finalization refactoring: Remove assertion-only finalize() methods from GIOPServerStarter and GIOPServer classes. - Removed finalize() from GIOPServerStarter (checked serverState == CLOSED) - Removed finalize() from GIOPServer (checked destroy_ and starter_ == null) - Both finalizers only contained Assert.ensure() calls with no cleanup logic - Lines added: 1, lines removed: 18 Tests: All 91,844 yoko-core tests pass Co-authored-by-AI: IBM Bob 1.0.4
Phase 3 of finalization refactoring: Remove finalize() method from Request class. - Removed finalizer that called multi.removeDeferredRequest(this) - Finalizer was redundant: Request objects in deferredRequests_ list have strong references and cannot be GC'd until removed from list - Finalizer could only run after request already removed (redundant) or during ORB shutdown (edge case not worth finalizer overhead) - Removed TODO comment about RequestStateSent memory leak - Lines removed: 32 Tests: All yoko-core tests pass Co-authored-by-AI: IBM Bob 1.0.4
Phase 3 of finalization refactoring: Remove finalize() methods from Delegate and DirectServant classes. - Removed Delegate.finalize() that called directServant.destroy() - directServant.destroy() is already called explicitly when needed - Finalizer was redundant safety net with no practical benefit - Removed DirectServant.finalize() assertion-only finalizer - Only contained ensure(deactivated_) assertion check - No actual cleanup logic - Lines added: 1, lines removed: 17 Tests: All yoko-core tests pass Co-authored-by-AI: IBM Bob 1.0.4
Phase 3 of finalization refactoring: Remove finalize() method from DirectSeqEntry inner class in ActiveObjectOnlyStrategy. - Removed finalizer that called deactivate() - deactivate() is already called explicitly in completeDeactivate() - Finalizer was redundant safety net with no practical benefit - Lines removed: 5 Tests: All yoko-core tests pass Co-authored-by-AI: IBM Bob 1.0.4
Phase 3 of finalization refactoring: Remove finalize() method from Transport_impl class. - Removed finalizer that called close() if socket_ was not null - close() is already called explicitly when transport is destroyed - Finalizer was redundant safety net with no practical benefit - Lines removed: 7 Tests: All yoko-core tests pass Co-authored-by-AI: IBM Bob 1.0.4
Phase 3 of finalization refactoring: Remove finalize() method from Connector_impl class. - Removed finalizer that called close() if socket_ was not null - close() is already called explicitly when connector is destroyed - Finalizer was redundant safety net with no practical benefit - Lines removed: 7 Tests: All yoko-core tests pass Co-authored-by-AI: IBM Bob 1.0.4
Phase 3 of finalization refactoring: Remove finalize() method from ORB_impl class. - Removed finalizer that logged warning if destroy() wasn't called - Finalizer was diagnostic-only with no actual cleanup logic - Warning was unreliable due to unpredictable finalization timing - Lines removed: 7 Tests: All yoko-core tests pass Co-authored-by-AI: IBM Bob 1.0.4
Phase 3 of finalization refactoring: Remove finalize() method from Acceptor_impl class. - Removed finalizer that called close() and removed from listenMap_ - close() is already called explicitly in GIOPServerStarter classes - listenMap_ cleanup was redundant as acceptors are explicitly managed - Removed TODO comment about using phantom refs in AccFactory_impl - Lines removed: 12 Tests: All yoko-core tests pass Co-authored-by-AI: IBM Bob 1.0.4
53adedf to
9666ecc
Compare
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
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.
Fixes #804