Skip to content

Commit bbe67ef

Browse files
Another attempt.
1 parent 6f55eed commit bbe67ef

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

dd-java-agent/instrumentation/java-concurrent/java-concurrent-21/src/previewTest/groovy/StructuredConcurrencyTest.groovy

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ class StructuredConcurrencyTest extends AgentTestRunner {
2121

2222
threadDumpTask = scheduler.scheduleAtFixedRate({
2323
File reportDir = new File("build")
24+
println("DEBUG: " + reportDir.absolutePath)
2425

25-
// Ensure the directory exists
2626
if (!reportDir.exists()) {
2727
println("build folder not found")
2828
return
@@ -33,10 +33,18 @@ class StructuredConcurrencyTest extends AgentTestRunner {
3333

3434
// Write to the file
3535
try (FileWriter writer = new FileWriter(reportFile)) {
36-
writer.write("=== Thread Dump Triggered at ${new Date()} ===\n")
36+
def s = "=== Thread Dump Triggered at ${new Date()} ===\n"
37+
println(s)
38+
writer.write(s)
3739
Thread.getAllStackTraces().each { thread, stack ->
38-
writer.write("Thread: ${thread.name}, daemon: ${thread.daemon}\n")
39-
stack.each { writer.write("\tat ${it}\n") }
40+
def t = "Thread: ${thread.name}, daemon: ${thread.daemon}\n"
41+
println(t)
42+
writer.write(t)
43+
stack.each {
44+
def st = "\tat ${it}\n"
45+
println(st)
46+
writer.write(st)
47+
}
4048
}
4149
writer.write("==============================================\n")
4250
}

dd-java-agent/instrumentation/lettuce-4/src/test/groovy/Lettuce4ClientTestBase.groovy

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ abstract class Lettuce4ClientTestBase extends VersionedNamingTestBase {
7373

7474
threadDumpTask = scheduler.scheduleAtFixedRate({
7575
File reportDir = new File("build")
76+
println("DEBUG: " + reportDir.absolutePath)
7677

77-
// Ensure the directory exists
7878
if (!reportDir.exists()) {
7979
println("build folder not found")
8080
return
@@ -85,10 +85,18 @@ abstract class Lettuce4ClientTestBase extends VersionedNamingTestBase {
8585

8686
// Write to the file
8787
try (FileWriter writer = new FileWriter(reportFile)) {
88-
writer.write("=== Thread Dump Triggered at ${new Date()} ===\n")
88+
def s = "=== Thread Dump Triggered at ${new Date()} ===\n"
89+
println(s)
90+
writer.write(s)
8991
Thread.getAllStackTraces().each { thread, stack ->
90-
writer.write("Thread: ${thread.name}, daemon: ${thread.daemon}\n")
91-
stack.each { writer.write("\tat ${it}\n") }
92+
def t = "Thread: ${thread.name}, daemon: ${thread.daemon}\n"
93+
println(t)
94+
writer.write(t)
95+
stack.each {
96+
def st = "\tat ${it}\n"
97+
println(st)
98+
writer.write(st)
99+
}
92100
}
93101
writer.write("==============================================\n")
94102
}

0 commit comments

Comments
 (0)