Getting the value of a global aggregate

You can get the values of global entity aggregates and global event aggregates in Java™ agents to evaluate conditions and make decisions in a Java agent.

About this task

After you define a global entity aggregate or global event aggregate in a .agg file, you can access the variable. In a Java agent, you must prefix defvar to the variable name.

Procedure

Call the AgentGlobalRuntime.getGlobalValue method in your Java code.
In the following example, the value of the global aggregate variable MaxSessionSize, which exists in a .agg file, is retrieved for use in subsequent code:
// to get the value of a global aggregate called MaxSessionSize.  The name is defined in the variable set.  The type of object returned is Double

Object entityValue = getGlobalValue("defvarMaxSessionSize");

The value that the getGlobalValue method returns is the same for the entire time the Java agent runs in response to an event. Therefore, if you call the getGlobalValue method multiple times, the same value is returned each time.