Skip to content

Commit a6a0132

Browse files
committed
🧹 Ensure proper cleanup in examples to avoid thread lingering warnings
1 parent e72ad29 commit a6a0132

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

03-CoreGenerativeAITechniques/examples/src/main/java/com/example/genai/techniques/completions/LLMCompletionsApp.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ public static void main(String[] args) {
5959

6060
// Example 3: Interactive chat
6161
interactiveChat(client);
62+
63+
// Force proper cleanup to avoid thread lingering warnings
64+
System.exit(0);
6265

6366
} catch (Exception e) {
6467
System.err.println("Error: " + e.getMessage());

03-CoreGenerativeAITechniques/examples/src/main/java/com/example/genai/techniques/functions/FunctionsApp.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ public static void main(String[] args) {
5959
// Example 2: Calculator function
6060
System.out.println("=== Calculator Function Example ===");
6161
calculatorFunctionExample(client);
62+
63+
// Force proper cleanup to avoid thread lingering warnings
64+
System.exit(0);
6265

6366
} catch (Exception e) {
6467
System.err.println("Error: " + e.getMessage());

03-CoreGenerativeAITechniques/examples/src/main/java/com/example/genai/techniques/rag/SimpleReaderDemo.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ public static void main(String[] args) throws IOException {
114114
System.err.println("Error calling the API: " + e.getMessage());
115115
e.printStackTrace();
116116
}
117+
118+
// Force proper cleanup to avoid thread lingering warnings
119+
System.exit(0);
117120
}
118121
}
119122

03-CoreGenerativeAITechniques/examples/src/main/java/com/example/genai/techniques/responsibleai/ResponsibleGithubModels.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ public static void main(String[] args) {
7070
System.out.println("\n=== Summary ===");
7171
System.out.println("This demonstration shows how GitHub Models implements responsible AI");
7272
System.out.println("safety measures by filtering harmful content and protecting users.");
73+
74+
// Force proper cleanup to avoid thread lingering warnings
75+
System.exit(0);
7376
}
7477

7578
/**

0 commit comments

Comments
 (0)