generated from gradle/gradle-issue-reproducer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Matt Riben <[email protected]>
- Loading branch information
1 parent
1977c36
commit 237c06c
Showing
4 changed files
with
218 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* This file was generated by the Gradle 'init' task. | ||
*/ | ||
|
||
plugins { | ||
`java-library` | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2") | ||
} | ||
|
||
java { | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(21) | ||
} | ||
} | ||
|
||
tasks.named<Test>("test") { | ||
// Use JUnit Platform for unit tests. | ||
useJUnitPlatform() | ||
setJvmArgs(listOf("-Xmx8G")) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.example</groupId> | ||
<artifactId>reproducer-project</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
|
||
<properties> | ||
<maven.compiler.source>21</maven.compiler.source> | ||
<maven.compiler.target>21</maven.compiler.target> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter</artifactId> | ||
<version>5.10.2</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>3.2.5</version> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import org.junit.jupiter.api.RepeatedTest; | ||
import org.junit.platform.commons.logging.Logger; | ||
import org.junit.platform.commons.logging.LoggerFactory; | ||
|
||
import java.lang.invoke.MethodHandles; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class IOTest { | ||
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); | ||
|
||
@RepeatedTest(50) | ||
void test1() { | ||
for (long loop = 0; loop < 10000; ++loop) { | ||
System.out.println("0123456789".repeat(50)); | ||
System.out.println("0123456789".repeat(50)); | ||
} | ||
} | ||
|
||
@RepeatedTest(50) | ||
void test2() throws Exception { | ||
List<Thread> threads = new ArrayList<>(); | ||
for (int i = 0; i < 100; ++i) { | ||
threads.add(Thread.ofPlatform().start(() -> { | ||
for (int j = 0; j < 100; ++j) { | ||
logger.info(() -> "0123456789".repeat(50)); | ||
logger.info(() -> "0123456789".repeat(50)); | ||
} | ||
})); | ||
} | ||
for (Thread thread : threads) { | ||
thread.join(); | ||
} | ||
} | ||
|
||
@RepeatedTest(50) | ||
void test3() throws Exception { | ||
List<Thread> threads = new ArrayList<>(); | ||
for (int i = 0; i < 100; ++i) { | ||
threads.add(Thread.ofVirtual().start(() -> { | ||
for (int j = 0; j < 100; ++j) { | ||
logger.info(() -> "0123456789".repeat(50)); | ||
logger.info(() -> "0123456789".repeat(50)); | ||
} | ||
})); | ||
} | ||
for (Thread thread : threads) { | ||
thread.join(); | ||
} | ||
} | ||
} |