GetGlobalVar

This function retrieves the global value that is saved by previous SetGlobalVar calls.

It should be used with a corresponding SetGlobalVar() call. The call only retrieves its own copy of the global variable.

Syntax

GetGlobalVar(variablename)

Parameters

Table 1. GetGlobalVar function parameters

Parameter

Description

variablename

Name of the variable whose value you want to retrieve.

Example

You can define in your policy a global flag to indicate if a particular exception happens when you run your policy. The flag is set to false originally. The exception handler in your policy sets the flag to true if an exception occurs. Your main policy can check the flag to decide if the exception happens after an action call such as SendJMSMessage().
function GetGlobalVarTest(){
Log("\nrunTimeFlag in getglobalvartest: " + GetGlobalVar("runTimeFlag"));
}

function SetGlobalVarGetGlobalVarTest(){

Handle java.lang.NullPointerException {
    Log("\nNull pointer exception: runTimeFlag is " + GetGlobalVar("runTimeFlag"));
}
Handle java.lang.Exception {
    Log("\nException thrown: runTimeTest is " + GetGlobalVar("runTimeFlag"));
}

Date = 1235414139;
SetGlobalVar("runTimeFlag", Date);

SendJMSMessage(com.sun.appserv.naming.S1ASCtxFactory, "jms/ConnectionFactory", 
"this is to test the exception handler");

Log("\nrunTimeFlag in saveglobalvar and getglobalvar test: " + 
GetGlobalVar("runTimeFlag"));
GetGlobalVarTest();
}