The MAES Automation Facility builds upon the MAES Generic Resource and Pre-Initialized Component capabilities and provides easier client coding and faster, more consistent client response time. To utilize the MAES Automation Facility, users must create a special class in the Aion application named MAES_Automation and marked for Export. In this class, users must create a public instance method named Init.
When the application is loaded, regardless of whether it is pre-initialized or dynamically loaded, MAES automatically invokes the Init method. The Init method can perform any initialization processing desired by the application, such as performing one-time DB2 access, setting up rules, and so on. The only coding requirement for the Init method is that it must provide an instance handle value which can be returned to client programs issuing Acquire calls. Since the instance handle is returned on the Acquire call, the client program no longer is required to make an additional call to create the instance handle required to execute the methods within the Aion application.
As an additional benefit, by creating an instance of the MAES_Automation class prior to executing the Init method, MAES automatically anchors the application symbol table. This ensures that the expense of creating the symbol table is only incurred once. For pre-initialized applications, the creation of the symbol table occurs prior to access by a client program, thus reducing client response time and making it more consistent. The application must not delete the MAES_Automation class instance because MAES saves its value and uses it later.
Users can also create a public instance method named Release in the MAES_Automation class. When the client program releases the Aion application, MAES automatically invokes the Release method. The Release method can perform any processing required to prepare the application for reuse by the next caller. The only coding requirement for the Release method is that it must provide an instance handle value which can be returned to client programs issuing Acquire calls. The instance handle returned by the Release method can be the same as the instance handle returned by the Init method, if desired. However, some applications may find it easier to delete all the instances of the application classes and simply create a new accessor instance.
As an additional benefit, the Release method of the MAES_Automation class is executed asynchronously. More specifically, control is returned to the client program immediately upon receipt of a release request and MAES executes the Release method while the client program continues to process. This reduces client response time by the amount of time required to prepare the Aion application program for reuse. MAES uses the value of the MAES_Automation class instance created at application initialization time to access the Release method repeatedly. This is why the application must not delete the MAES_Automation class instance.
While it is to the user's advantage to code a Release method in the MAES Automation class, it is not required. However, if a Release method is not coded, some other method called by the client program must prepare the Aion application for reuse and the client program response time will be increased by the amount of time required to prepare the Aion application for reuse. Also, without a Release method, the instance handle returned by the Init method cannot be altered, precluding the option of deleting and recreating the accessor instance.
Both the Init and Release methods return an integer value. Normally, this return value should be zero (0). However, if an error condition is encountered by the Aion application, a non-zero value can be returned and the Aion application terminated by MAES. For pre-initialized Aion applications, each copy of the application is given an opportunity to initialize. If a temporary problem (such as a database condition) causes an insufficient number of copies to initialize, additional copies are started automatically when Acquire requests arrive. If the Init method return value is non-zero for a dynamically started Aion application, the client program receives an error code indicating that the Aion application was terminated. Regardless of when Aion applications are terminated due to non-zero Init or Release return values, if the supply of available Aion applications is exhausted, MAES attempts to start a new copy dynamically when the next Acquire call is received.
In order to utilize the MAES Automation Facility, online client programs must use the ACQUIRE and RELEASE functions. See the Objserv sample Aion application for an example of how to code the Init and Release methods in the MAES_Automation class. See the sample client programs ending in '4' for examples of client programs using the MAES Automation Facility.
| Copyright © 2009 CA. All rights reserved. | Email CA about this topic |