Created
May 8, 2023 09:18
-
-
Save franz1981/55e6aa9b61b1cab7fe38df5eae8c1860 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// javac Main.java | |
// java -XX:-Inline -XX:-TieredCompilation Main 36 8000000 | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
interface I1 {} | |
interface I2 {} | |
interface I3 extends I1, I2 {} | |
class B implements I3 {} | |
class C implements I3 {} | |
public class Main { | |
public static void main(String[] args) { | |
int numThreads = Integer.parseInt(args[0]); | |
int loopCount = Integer.parseInt(args[1]); | |
ExecutorService es = Executors.newFixedThreadPool(numThreads); | |
I3 b = new B(); | |
I3 c = new C(); | |
for (int i = 0; i != numThreads; i++) { | |
es.submit(() - >{ | |
for (int j = 0; j != loopCount; j++) { | |
foo(b); | |
foo(c); | |
goo(b); | |
goo(c); | |
} | |
}); | |
} | |
es.shutdown(); | |
} | |
public static boolean foo(I3 i) { | |
return i instanceof I1; | |
} | |
public static boolean goo(I3 i) { | |
return i instanceof I2; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment