Example

This code demonstrates the properties in this section:

public class CountMessagesTPS extends TPS
{ 
public static int global_cnt = 0;
public int local_cnt = 0; 
public DispositionList process(CloverEnv cloverEnv,  String context,  String mode, Message msg)
throws CloverleafException 
{ 
DispositionList dl = new DispositionList(); 
if (mode.equals("run")) {
System.out.println("global_cnt: " + global_cnt++);
System.out.println("local_cnt: " + local_cnt++);
} 
return dl;
}
} 

When this is set as the Inbound Data TPS UPoC of the Inbound thread and Outbound Data TPS UPoC of the outbound thread, this message is shown in the log as the engine processes messages:

Inbound Thread: global_cnt: 0
Inbound Thread: local_cnt: 0
Outbound Thread: global_cnt: 1
Outbound Thread: local_cnt: 0
Inbound Thread: global_cnt: 2
Inbound Thread: local_cnt: 1
Outbound Thread: global_cnt: 3
Outbound Thread: local_cnt: 1
Inbound Thread: global_cnt: 4
Inbound Thread: local_cnt: 2
Outbound Thread: global_cnt: 5
Outbound Thread: local_cnt: 2