Supporting instance pooling in your component

Instance pooling eliminates resource drain caused by repeated allocation of new component instances.

For Java components, you can implement a life cycle interface to control whether the component instances are pooled. These interfaces also provide activate and deactivate methods that are called to indicate state transitions in a component instance’s lifetime. See “Set transactional state”.

For PowerBuilder components, you can enable the Pooling option on the PowerBuilder wizard that you use to create your component. You can then write event scripts that respond to changes in an instance’s life cycle. See the Application Techniques manual in the PowerBuilder documentation for more information.

For C and C++ components, you can enable instance pooling using the Management Console. See “CORBA component property descriptions”. This method also allows you to configure pooling for Java components that do not implement the ServerBean or IObjectControl interfaces, respectively.

To support instance pooling, code that responds to activation events must restore the component to its initial state (that is, as if it were newly created). the Java canReuse interfaces have methods that allow an instance to selectively refuse pooling. For PowerBuilder components, you can script the canBePooled event to selectively refuse pooling.

When the component Pooled option is set in the Management Console, the Java canReuse method is not called, even if the component implements the ServerBean interface.