IsAlive
PowerScript function
Description
Determines whether a server object is still running.
Applies to
OLEObject objects, OLETxnObject objects
Syntax
|
1 |
oleobject.IsAlive ( ) |
|
Argument |
Description |
|---|---|
|
oleobject |
The name of an OLEObject or OLETxnObject variable that is |
Return value
Boolean.
Returns true if the server object appears to be running and false if
it is dead.
Usage
Use the IsAlive function to determine whether a server process has
died. This function does not replace the error-handling capability
provided by the ExternalException and Error events. It provides a way to
check the viability of the server at intervals or before specific
operations to avoid runtime errors.
If IsAlive returns true, the server may only appear to be running,
because the true state of the server may be masked. This is more likely to
occur when the server is running on a different computer, because DCOM may
be using cached information to determine the state of the server. A false
return value always indicates that the server is dead.
Examples
This example creates an OLEObject variable and calls
ConnectToNewObject to create and connect to a new instance of a
PowerBuilder COM object. After performing some processing, it checks
whether the server is still running before performing additional
processing:
|
1 2 3 4 5 6 7 8 9 10 |
OLETxnObject EmpObj Integer li_rc EmpObj = CREATE OLEObject li_rc = EmpObj.ConnectToNewObject("PB70COM.employee") // Perform some work with the COM object ... IF EmpObj.IsAlive()THEN // Continue processing END IF |