Step 9 : ARM 4.0 Java Hello World example

Description

Having measured our transaction with ARM the only thing left to do is to tell ARM we have finished by calling the end() method of the ArmApplication object.

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:         app.end();
24:         System.exit(0);
25:     }
26: }