Hitachi

In-Memory Data Grid Hitachi Elastic Application Data Store


17.2.1 Flow of a user function

The following figure shows a flow of a user function.

[Figure]

Organization of this subsection

(1) Importing the EADS-provided packages

Import the following EADS-provided packages:

import com.hitachi.software.xeads.func.Function;
import com.hitachi.software.xeads.func.FunctionContext;

(2) Implement user function initialization processing

Use init() of the Function interface to implement the user function initialization processing that is called when the EADS server starts up.

You can acquire the EADS server information with the FunctionContext argument of init(). Note that data in cache cannot be obtained because init() is called when the EADS server starts up.

If an exception occurs during the execution of init(), this user function cannot be used.

(3) Implement user function processing

Use execute() of the Function interface to implement the user function processing that is executed on the EADS server when it is requested by the EADS client.

You can acquire the EADS server information and manipulate data in cache with the FunctionContext argument of execute().

For details about the operations that can be performed by user functions, see 18.2 API interfaces supported in user functions.

(4) Implement user function termination processing

Use destroy() of the Function interface to implement the user function termination processing that is called when the EADS server is terminated.

You can acquire the EADS server information with the FunctionContext argument of destroy().

Note that if user function initialization processing fails, destroy() is not called.