fix(memory-leaks): Add JVM shutdown hooks, fix resource leaks, fix race conditions#7
Open
maheshkumargangula wants to merge 2 commits into
Open
fix(memory-leaks): Add JVM shutdown hooks, fix resource leaks, fix race conditions#7maheshkumargangula wants to merge 2 commits into
maheshkumargangula wants to merge 2 commits into
Conversation
…onditions - Add JVM shutdown hook for Redis client graceful cleanup (ML-03) - Add JVM shutdown hook for Kafka producer/consumer cleanup (ML-02) - Fix XSSFWorkbook resource leak using try-with-resources in ExcelFileUtil (ML-04) - Fix Cassandra session race condition using ConcurrentHashMap.computeIfAbsent (ML-07) - Replace unbounded static HashMap with bounded LRU LinkedHashMap in ElasticSearchHelper (ML-01) - Add shared ObjectMapper singleton to JsonUtil, replace 8 per-call instantiations (ML-06) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
741b5e0 to
035ca15
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.
PR Title
fix(memory-leaks): Add JVM shutdown hooks, fix resource leaks, fix race conditions
Base Branch
develop
Summary
RedisConnectionManager— gracefully callsclient.shutdown()on JVM termination (like Cassandra/ES already do)KafkaClient— flushes producer then closes both producer and consumerExcelFileUtil.writeToFile()to use try-with-resources for bothXSSFWorkbookandFileOutputStreamget()+put()inCassandraConnectionManagerImpl.getSession()withConcurrentHashMap.computeIfAbsent()HashMapforindexMap/typeMapinElasticSearchHelperwith bounded LRULinkedHashMap(max 500 entries)public static final ObjectMapper MAPPERsingleton toJsonUtil; updated 8 service classes to reuse itFiles Changed
core/sunbird-redis-utils/.../RedisConnectionManager.javacore/sunbird-redis-utils/.../RedisCache.javacore/sunbird-platform-common/.../KafkaClient.javacore/sunbird-platform-common/.../ExcelFileUtil.javacore/sunbird-platform-common/.../JsonUtil.javacore/sunbird-cassandra-utils/.../CassandraConnectionManagerImpl.javacore/sunbird-es-utils/.../ElasticSearchHelper.javamodules/userorg/service/...(ObjectMapper singleton adoption)Implements Tasks
ML-01, ML-02, ML-03, ML-04, ML-06, ML-07
Test Plan
mvn clean install -DskipTestsnew ObjectMapper()in method bodies of updated files