Skip to content

Commit 8429062

Browse files
One more try
1 parent 9d9f161 commit 8429062

File tree

2 files changed

+24
-28
lines changed

2 files changed

+24
-28
lines changed

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

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,36 +17,34 @@ class StructuredConcurrencyTest extends AgentTestRunner {
1717
ScheduledFuture<?> threadDumpTask
1818

1919
def setup() {
20-
scheduler = Executors.newSingleThreadScheduledExecutor()
20+
File reportDir = new File("build")
21+
String fullPath = reportDir.absolutePath.replace("dd-trace-java/dd-java-agent",
22+
"dd-trace-java/workspace/dd-java-agent")
23+
24+
reportDir = new File(fullPath)
25+
if (!reportDir.exists()) {
26+
println("Folder not found: " + fullPath)
27+
reportDir.mkdirs()
28+
}
29+
else println("Folder found: " + fullPath)
2130

31+
scheduler = Executors.newSingleThreadScheduledExecutor()
2232
threadDumpTask = scheduler.scheduleAtFixedRate({
23-
File reportDir = new File("build")
24-
String fullPath = reportDir.absolutePath.replace("dd-trace-java/dd-java-agent",
25-
"dd-trace-java/workspace/dd-java-agent")
26-
27-
reportDir = new File(fullPath)
28-
if (!reportDir.exists()) {
29-
println("Folder not found: " + fullPath)
30-
reportDir.mkdirs()
31-
}
32-
3333
// Define the file path
3434
File reportFile = new File(fullPath, String.format("thread-dump-%d.log", System.currentTimeMillis()))
3535

3636
// Write to the file
3737
try (FileWriter writer = new FileWriter(reportFile)) {
38-
println(s)
3938
writer.write("=== Thread Dump Triggered at ${new Date()} ===\n")
4039
Thread.getAllStackTraces().each { thread, stack ->
41-
println(t)
4240
writer.write("Thread: ${thread.name}, daemon: ${thread.daemon}\n")
4341
stack.each {
4442
writer.write("\tat ${it}\n")
4543
}
4644
}
4745
writer.write("==============================================\n")
4846
}
49-
}, 60_000, 60_000, TimeUnit.MILLISECONDS)
47+
}, 10, 60_000, TimeUnit.MILLISECONDS)
5048
}
5149

5250
def cleanup() {

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

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -69,36 +69,34 @@ abstract class Lettuce4ClientTestBase extends VersionedNamingTestBase {
6969
}
7070

7171
def setup() {
72-
scheduler = Executors.newSingleThreadScheduledExecutor()
72+
File reportDir = new File("build")
73+
String fullPath = reportDir.absolutePath.replace("dd-trace-java/dd-java-agent",
74+
"dd-trace-java/workspace/dd-java-agent")
75+
76+
reportDir = new File(fullPath)
77+
if (!reportDir.exists()) {
78+
println("Folder not found: " + fullPath)
79+
reportDir.mkdirs()
80+
}
81+
else println("Folder found: " + fullPath)
7382

83+
scheduler = Executors.newSingleThreadScheduledExecutor()
7484
threadDumpTask = scheduler.scheduleAtFixedRate({
75-
File reportDir = new File("build")
76-
String fullPath = reportDir.absolutePath.replace("dd-trace-java/dd-java-agent",
77-
"dd-trace-java/workspace/dd-java-agent")
78-
79-
reportDir = new File(fullPath)
80-
if (!reportDir.exists()) {
81-
println("Folder not found: " + fullPath)
82-
reportDir.mkdirs()
83-
}
84-
8585
// Define the file path
8686
File reportFile = new File(fullPath, String.format("thread-dump-%d.log", System.currentTimeMillis()))
8787

8888
// Write to the file
8989
try (FileWriter writer = new FileWriter(reportFile)) {
90-
println(s)
9190
writer.write("=== Thread Dump Triggered at ${new Date()} ===\n")
9291
Thread.getAllStackTraces().each { thread, stack ->
93-
println(t)
9492
writer.write("Thread: ${thread.name}, daemon: ${thread.daemon}\n")
9593
stack.each {
9694
writer.write("\tat ${it}\n")
9795
}
9896
}
9997
writer.write("==============================================\n")
10098
}
101-
}, 60_000, 60_000, TimeUnit.MILLISECONDS)
99+
}, 10, 60_000, TimeUnit.MILLISECONDS)
102100

103101
redisServer.start()
104102

0 commit comments

Comments
 (0)