To define a C++ component, use EAServer Manager to create an Interface Definition Language (IDL) module and interface, assign the interface to the component, define the properties for the component, and then define the methods in the component. Define each method’s return type and parameters. For each parameter, define its datatype and argument mode.
Chapter 4, “Defining Components” describes how to define and configure new components in EAServer Manager.
The component’s transaction property determines how it participates in transactions. You can view and change this property using the Transactions tab of the component’s property sheet. For a description of each option on the Transactions tab, see “Component properties: Transactions”. A transaction consists of a number of database updates (which can be performed by multiple components) that are grouped into a single atomic unit of work.
For a full description of how EAServer handles transactions, see Chapter 2, “Understanding Transactions and Component Lifecycles.”
The threading property imposes constraints on the concurrent execution of the component in different threads. You can view and change these properties using the Threading tab of the component’s property sheet.
In single threading, multiple instances can exist simultaneously, but only one can be active at any one time. EAServer synchronizes instantiations, method invocations, and the destruction of all instances. Use single threading if your component shares volatile global data or stateful resources between instances.
This setting determines the constraints that are placed on the concurrent execution of different instances of the component. The following settings specify the constraints that are placed on concurrent execution of different instances of the component. The choices are:
Concurrency – Multiple invocations can be processed concurrently; that is, multiple instances can be simultaneously active on different threads. The component must be thread-safe. Use this setting if the component code uses no volatile global data and does not maintain data in resources (such as files) that are shared among instances. For example, you could not use this setting if every component instance opened the same file and wrote text to it. An example of volatile global data could be a counter that is stored in a global variable. This threading model offers the highest performance.
You can use the EAServer shared properties feature in your component code to share data safely among instances of a multiple-threaded component. See “Share data between C or C++ components” for more information.
Bind Thread – Instances are bound to the creating thread. The component uses thread-local storage.
This setting determines whether a component instance is always invoked in the same thread or can be invoked on any thread. By default, this check box is not selected, which indicates that EAServer can invoke the component’s methods with any thread.
Use the default setting unless your component uses thread-local storage. EAServer provides no APIs for thread-local storage, but you can issue thread system calls from the C++ component code. Do not use thread-local storage if you are implementing new components. Instead, use instance variables to associate data with a specific component. If you incorporate existing code that uses thread-local storage into a C++ component, select this setting.
Pooling – Instances are pooled after a commit or rollback.
Sharing – A single shared instance services all client requests. This model offers the worst performance. Use this model only if the logic in your code requires that only one component instance exist at one time. Attempts to create new instances when one already exists will fail.
You define methods by specifying each method’s return type and parameters. For each parameter, you define its datatype and argument mode. You use a method’s property sheet to define its return type and parameters.
Chapter 5, “Defining Component Interfaces” describes how to define IDL methods in the component interface. “Supported datatypes” describes the IDL to C++ type mappings.
Instead of defining methods using EAServer Manager, you can code a Java interface that defines your component’s methods and import it into EAServer Manager. See “Importing interfaces from compiled Java files” for more information.
Optionally configure a control interface for the component. Using a control interface allows you to implement methods to respond to changes in the instance lifecycle. See “Configuring a control interface” for more information.
Copyright © 2005. Sybase Inc. All rights reserved. |