Mercurial > hg > Database > Christie
changeset 197:4d8f90e8a92c
add priority test
author | akahori |
---|---|
date | Sat, 09 Mar 2019 14:03:25 +0900 |
parents | ad49723367c2 |
children | dd3c0ba6a0a6 |
files | src/main/java/christie/test/PriorityTest/PriorityTestCodeGear.java src/main/java/christie/test/PriorityTest/StartPriorityTest.java |
diffstat | 2 files changed, 56 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/christie/test/PriorityTest/PriorityTestCodeGear.java Sat Mar 09 14:03:25 2019 +0900 @@ -0,0 +1,28 @@ +package christie.test.PriorityTest; + +import christie.codegear.CodeGear; +import christie.codegear.CodeGearManager; + +public class PriorityTestCodeGear extends CodeGear { + String name; + int delay; + public PriorityTestCodeGear(String name, int delay){ + this.name = name; + this.delay = delay; + } + + @Override + protected void run(CodeGearManager cgm) { + System.out.println(name); + sleep(delay); + } + + private static void sleep(long millis) { + try { + Thread.sleep(millis); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new RuntimeException(e); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/christie/test/PriorityTest/StartPriorityTest.java Sat Mar 09 14:03:25 2019 +0900 @@ -0,0 +1,28 @@ +package christie.test.PriorityTest; + +import christie.codegear.CodeGearManager; +import christie.codegear.StartCodeGear; + +public class StartPriorityTest extends StartCodeGear { + + public StartPriorityTest(CodeGearManager cgm) { + super(cgm); + } + + public static void main(String[] args) { + + int max = 10; + + CodeGearManager cgm = createCGM(10000); + //Priority=0 + for(int i = 0; i < max; i ++){ + cgm.setup(new PriorityTestCodeGear("A" + String.valueOf(i), 200),0); //Defaults to priority=0 + } + + for(int i = 0; i < max; i ++){ + cgm.setup(new PriorityTestCodeGear("B" + String.valueOf(i), 200),1); //Defaults to priority=0 + } + + } + +} \ No newline at end of file