publicclass Main { privatestaticfinalint TEST_TIME = 5;
publicstaticvoid main(String[] args) {
System.out.println("Running (" + TEST_TIME + " seconds) ...");
InfiniteDoWhileLoopWithLong doWhileLoopWithLong = new InfiniteDoWhileLoopWithLong();
SimpleLoopThread[] simpleLoops = { new InfiniteForLoop(), new InfiniteWhileLoop(), new InfiniteWhileLoopWithIntrinsic(), new InfiniteDoWhileLoop(), new MakeGarbage(), new InfiniteWhileLoopWithSpecialReturnArgOrConst(new SpecialMethods1()), new InfiniteWhileLoopWithSpecialReturnArgOrConst(new SpecialMethods2()), new InfiniteWhileLoopWithSpecialPutOrNop(new SpecialMethods1()), new InfiniteWhileLoopWithSpecialPutOrNop(new SpecialMethods2()), new InfiniteWhileLoopWithSpecialConstOrIGet(new SpecialMethods1()), new InfiniteWhileLoopWithSpecialConstOrIGet(new SpecialMethods2()), new InfiniteWhileLoopWithSpecialConstOrIGetInTryCatch(new SpecialMethods1()), new InfiniteWhileLoopWithSpecialConstOrIGetInTryCatch(new SpecialMethods2()),
};
doWhileLoopWithLong.start(); for (SimpleLoopThread loop : simpleLoops) {
loop.start();
} for (int i = 0; i < TEST_TIME; i++) {
Runtime.getRuntime().gc();
System.out.println(".");
sleep(1000);
}
doWhileLoopWithLong.stopNow(); for (SimpleLoopThread loop : simpleLoops) {
loop.stopNow();
}
System.out.println("Done.");
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.