You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2021/03/12 04:51:57 UTC

[GitHub] [geode] DonalEvans commented on a change in pull request #6125: GEODE-6143: remove powermock from LinuxSystemStatsTest

DonalEvans commented on a change in pull request #6125:
URL: https://github.com/apache/geode/pull/6125#discussion_r592908308



##########
File path: geode-core/src/main/java/org/apache/geode/internal/statistics/platform/LinuxProcFsStatistics.java
##########
@@ -156,14 +152,24 @@ public static void refreshProcess(int pid, LocalStatisticsImpl stats) {
   }
 
   public static void refreshSystem(LocalStatisticsImpl stats) {
+    try {
+      refreshSystem(stats, new FileInputStream("/proc/stat"),
+          new FileInputStream("/proc/net/netstat"));

Review comment:
       I think that the potential resource leaks here can be fixed by using try with resources:
   ```
   try (FileInputStream procStat = new FileInputStream("/proc/stat");
   FileInputStream netStat = new FileInputStream("/proc/net/stat")) {
       refreshSystem(stats, procStat, netStat);
   }
   ```




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org