getSessionCount

Description

With getSessionCount method, you can get the following three types of information.

  • The total number of active sessions opened for the specified application in the specified PowerServer.

  • The total number of active sessions in a specified PowerServer.

  • The total number of sessions opened for the specified application in a PowerServer cluster. To get the number of sessions in a PowerServer cluster, you need to first configure the cluster in AEM.

Usage

By using the getSessionCount method, you can easily get the total number of active sessions in a specified PowerServer using PowerBuilder code and apply the information in other open interfaces, such as KillSession, to manage the sessions. For example, you can first call getSessionCount and then call KillSession to make the deployed application kill all sessions in PowerServer when there are up to 100 active sessions in the server.

Syntax for .NET component

proxyobject.of_execinterface ( "getSessionCount", ref any paralist[] )

Table 15. 

Argument

Description

proxyobject

The instance of the proxy object generated for AppeonDotNetComponent.

paralist[]

Arrays of Any type. Specifies the parameter arrays for the component function.

paralist[1] - The name of the PowerServer in which the active sessions are created. The value should be IP address or IP address with port number, for example, 192.0.0.123, or 192.0.0.123:8080, and separated with semicolons (;) if there are multiple servers (for example in a PowerServer cluster). If paralist[1] is NULL or an empty string (""), getSessionCount returns the number of the active sessions in a PowerServer cluster.

paralist[2] - The name of the application that is deployed to the PowerServer for which you want to know how many sessions are opened. If paralist[2] is NULL or empty string (""), getSessionCount returns the total number of active sessions in the specified PowerServer.


Return value of of_execinterface

Returns 0 if of_execinterface function succeeds and one of the following negative values if an error occurs.

-1: function fails to execute

-2: the specified PowerServer is not found

-3: the specified application is not found

Return value of getSessionCount

Returns the number of active sessions if getSessionCount function succeeds and returns an empty string if an error occurs.

The return value is stored in the ReturnValue property of the proxy object.

Code example

Any la_l[] 
Long lRet 
...
la_l[1] = ls_servername
la_l[2] = ls_appname

lRet = loadDBList.of_ExecInterface ("getSessionCount", la_l) //result is returned to loadDBList.ReturnValue

Syntax for EJB component

io_ejb.regstring ( String serverName )

io_ejb.regstring ( String appName )

io_ejb.Invokeretint ( long objid, "getSessionCount", true, ref integer retval )

Table 16. 

Argument

Description

io_ejb

A reference of Appeon EJBobject.

serverName

The name of the PowerServer in which the active sessions are created. The value should be IP address or IP address with port number, for example, 192.0.0.123, or 192.0.0.123:8080, and separated with semicolons (;) if there are multiple servers (for example in a PowerServer cluster).

If serverName is NULL or an empty string (""), getSessionCount returns the number of the active sessions in a PowerServer cluster.

appName

The name of the application that is deployed to the PowerServer for which you want to know how many sessions are opened.

If appName is NULL or empty string (""), getSessionCount returns the total number of active sessions in the specified PowerServer.

objid

The handle to the component method.

retval

The return value of getSessionCount function: the number of active sessions opened for the specified application in the specified PowerServer. This parameter must be declared, but need not to be assigned with values, as it is used to hold the return value.

Return value of Invokeretint

Returns 0 if Invokeretint function succeeds and one of the following negative values if an error occurs.

-1: function fails to execute

-2: the specified PowerServer is not found

-3: the specified application is not found

Return value of getSessionCount

Returns the number of active sessions opened for the specified application in the specified PowerServer if getSessionCount function succeeds or returns an empty string if an error occurs.

The return value is stored in the retval parameter of Invokeretint function.

Code example

Note invokeretint function is called because the return value is an integer.

string ls_msg 
int retval01 
...
io_ejb.regstring (ls_servername) 
io_ejb.regstring (ls_appname) 

ls_msg = io_ejb.invokeretint (il_bean1, "getSessionCount", true, ref retval01) //result is returned to retval01

Syntax for Web Service

getSessionCount ( string serverName, string appName )

Table 17. 

Argument

Description

serverName

The name of the PowerServer in which the active sessions are created. The value should be IP address or IP address with port number, for example, 192.0.0.123, or 192.0.0.123:8080, and separated with semicolons (;) if there are multiple servers (for example in a PowerServer cluster). If serverName is NULL or an empty string (""), getSessionCount returns the number of the active sessions in a PowerServer cluster (you will need to configure the cluster in AEM first).

appName

The name of the application that is deployed to the PowerServer for which you want to know how many sessions are opened. If appName is NULL or empty string (""), getSessionCount returns the total number of active sessions in the specified PowerServer.

Return value

Long.

Returns the number of sessions in the specified PowerServer if the function succeeds or returns -1 if an error occurs.

Code example

//-- connected with the web service
……
Long ll_return
String ls_server, ls_app
ls_server = sle_1.text
ls_app = sle_2.text
ll_return = ieon_ws.getSessionCount (ls_server, ls_app)