Consultor Eletrônico



Kbase 19377: OPEN CLIENT: How to Specify an SDOResultSet as Stateless
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   1/3/2000
In version 9.1A of Progress, the Open Client Toolkit ships with an SDO (SmartDataObject) wrapper for the Java environment (SDOResultSet).

By default, when an SDOResultSet is instantiated (i.e. bound to a specific .w on the AppServer) the .w is run persistently. This causes the AppServer server process to become bound to the client that instantiated the SDOResultSet. In a State-Reset or State-Aware AppServer environment this is not a problem. However, in a Stateless AppServer environment this can cause problems because the AppServer server process cannot process requests for any other client while the SDOResultSet is active in the Java program.

To workaround this potential problem you can specify that the SDOResultSet run in a non-persistent mode on the AppServer. This allows you to run your AppServer in a Stateless environment without locking out users.

The key to instantiating an SDOResultSet so that it works properly in a Stateless AppServer environment is to remember to create an SDOParameters object, invoke the setStateless(true) method and then pass this object to the _createSDOResultSet method of the SDOAppObject class.

The example code shown below shows how this code might look in a real application:

public static void main(String[] args)
{
SDOParameters params = new SDOParameters();
SDOAppObject asv = null;
SDOResultSet data = null;

try
{
// Configure SDO Parameters for a Stateless
//AppServer Environment
params.setStateless(true);

// Connect to AppServer and Instantiate SmartDataObject
asv = new SDOAppObject("AppServer://zzz:5162/y",null,null,null);

data = asv._createSDOResultSet("dCustomer.w", null, null, params);
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
// Close ResultSet and Disconnect from AppServer
try
{
data.close();
asv._release();
}
catch (Exception e)
{
}
finally
{
System.exit(0);
}
}
}