ShauryaChauhan1411 opened a new pull request, #17286:
URL: https://github.com/apache/iotdb/pull/17286

   The current SessionPoolExample uses Executors.newFixedThreadPool(10), which 
internally relies on an unbounded LinkedBlockingQueue. In scenarios with high 
task submission rates, this unbounded queue can grow indefinitely, leading to 
OutOfMemoryError (OOME) and system instability.
   
   Changes
   
   Replaced the unbounded fixed thread pool with a custom ThreadPoolExecutor.
   
   Implemented a bounded ArrayBlockingQueue with a capacity of 1000 to limit 
memory consumption.
   
   Configured ThreadPoolExecutor.CallerRunsPolicy as the rejection handler. 
This ensures that if the queue is full, the submitting thread executes the 
task, providing a natural backpressure mechanism and preventing task loss or 
system crashes.
   
   Test Result
   
   Verified the build using mvn clean install -DskipTests -pl example/session.
   
   Applied code formatting using mvn spotless:apply.


-- 
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]

Reply via email to