Salesforce

Runtime Engine Behavior - Java (Magic xpa 4.x)

« Go Back

Information

 
Created BySalesforce Service User
Approval Process StatusPublished
Objective
Description

Runtime Engine Behavior

This section describes the runtime behavior of programs that call Java functions. For the Java functions to work at runtime, the Java Development Kit or the Java Runtime Environment must be installed, and the called Java classes should be in the environment class path.

Life Cycle

All pseudo-references obtained by an engine from a Java or EJB function are released to the Java Virtual Machine when the context is terminated.

Multi-Threading

Each engine context has its own pseudo-references. Pseudo-references of one engine context will have no influence over pseudo-references of another engine context, even if these pseudo-references represent the same Java class. Access to static class methods or variables need to be synchronized on the Java side by using the synchronized keyword in the method.

Browser-Based Programs

Magic xpa can create a pseudo-reference from the JCreate function at any time during the engine context's life cycle and use the pseudo-reference during subsequent events of the engine context.

Conversion Tables

The table below describes the automatic conversions by the signature of outgoing values for JCreate, JCall, JSet, JCallStatic, and JSetStatic functions and the return values for JCall, JGet, JCallStatic, and JGetStatic functions.

Magic xpa Types

Java Types

Primitive Type

Object Type

Alpha, BLOB

char, byte, char[ ], byte [ ]

String, StringBuffer, Character, Byte, Byte [ ], Character [ ]

Logical

boolean

Boolean

Numeric, Date, Time

byte, short, int, long, float, double

Byte, Short, Integer, Long, Float, Double

The table below displays the default mapping for the return value types.

Java Types

Magic xpa Types

Primitive Type

Object Type

char, char[ ]

String, StringBuffer, Character

Alpha (up to 32K)
BLOB (above 32K)

byte[ ]

BLOB

boolean

Boolean

Logical

byte, short, int, long, float, double

Byte, Short, Integer, Long, Float, Double

Numeric

Returning Pseudo-Reference Values

You can disable the automatic conversion described in the previous section by using: signature*p

For an automatic conversion:

JCall(A, ‘increment2’, ‘()Ljava/lang/Long;’) –The function returns the numeric value of the Long object

For disabling an automatic conversion:

JCall(A, ‘increment2’, ‘()Ljava/lang/Long;*p’) –The function returns a pseudo-reference (BLOB variable) of the Long object.

Errors and Exception Handling

Magic xpa Java Functions can fail to load a class, locate a requested constructor by a specified type signature, or catch an exception.

Garbage Collection Mechanism

When closing a task, after applying modifications to updated parameters or return values, Magic xpa will automatically release pseudo-reference values that are not assigned to a variable in the task tree containing the task and are not currently saved by SetParam/SharedValSet. This action releases the unnecessary resources.

Reference
Attachment 
Attachment