Determines whether a server object is still running.
OLEObject objects, OLETxnObject objects
oleobject.IsAlive ( )
Argument |
Description |
---|---|
oleobject |
The name of an OLEObject or OLETxnObject variable that is connected to an automation server or COM object |
Boolean. Returns true if the server object appears to be running and false if it is dead.
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.
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:
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