Step 8 : ARM 4.0 Java Hello World example
Description
Now we are prepared to measure our transaction with ARM:
- We call the start() method of our ArmTransaction object to
start the transaction measurement
- After our transaction is complete we call the stop() method
passing the status how our transaction completed:
- STATUS_GOOD - indicates the transaction executed successfully
Code
01: import org.opengroup.arm40.transaction.*;
02:
03: public class HelloWorld {
04:
05: public static void main(String argv[]) throws Exception {
06:
07: ArmTransactionFactory tranFactory;
08: if ((tranFactory = getTranFactory())==null) {
09: System.exit(-1);
10: }
11: ArmApplicationDefinition appDef =
12: tranFactory.newArmApplicationDefinition("HelloTranApp",
13: null, null);
14: ArmTransactionDefinition tranDef =
15: tranFactory.newArmTransactionDefinition(appDef, "HelloWorldJava",
16: null, null);
17: ArmApplication app =
18: tranFactory.newArmApplication(appDef, "Examples", null, null);
19: ArmTransaction tran = tranFactory.newArmTransaction(app, tranDef); |
20: tran.start(); |
21: System.out.println("Hello world!"); |
22: tran.stop(ArmConstants.STATUS_GOOD); |
23: System.exit(0);
24: }
25: } |
|