From 717db5ed2094358a15d2185be5ccc7014f7b4f58 Mon Sep 17 00:00:00 2001 From: Zoe Wang <33073555+zoewangg@users.noreply.github.com> Date: Fri, 23 Feb 2024 11:59:02 -0800 Subject: [PATCH] =?UTF-8?q?Log=20leaked=20native=20resources=20using=20err?= =?UTF-8?q?or=20log=20level=20in=20waitForNoResourc=E2=80=A6=20(#765)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/software/amazon/awssdk/crt/CrtResource.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/software/amazon/awssdk/crt/CrtResource.java b/src/main/java/software/amazon/awssdk/crt/CrtResource.java index ea3eb5ba6..8f4aa5b40 100644 --- a/src/main/java/software/amazon/awssdk/crt/CrtResource.java +++ b/src/main/java/software/amazon/awssdk/crt/CrtResource.java @@ -373,9 +373,13 @@ public static void collectNativeResource(Consumer fn) { * Debug method to log all of the currently un-closed CRTResource objects. */ public static void logNativeResources() { - Log.log(ResourceLogLevel, Log.LogSubject.JavaCrtResource, "Dumping native object set:"); + logNativeResources(ResourceLogLevel); + } + + public static void logNativeResources(Log.LogLevel logLevel) { + Log.log(logLevel, Log.LogSubject.JavaCrtResource, "Dumping native object set:"); collectNativeResource((resource) -> { - Log.log(ResourceLogLevel, Log.LogSubject.JavaCrtResource, resource.getWrapper().getResourceLogDescription()); + Log.log(logLevel, Log.LogSubject.JavaCrtResource, resource.getWrapper().getResourceLogDescription()); }); } @@ -436,7 +440,7 @@ public static void waitForNoResources() { if (resourceCount != 0) { Log.log(Log.LogLevel.Error, Log.LogSubject.JavaCrtResource, "waitForNoResources - timeOut"); - logNativeResources(); + logNativeResources(Log.LogLevel.Error); throw new InterruptedException(); } } catch (InterruptedException e) {