Kbase P15973: How to determine which persistent procedures are currently running.
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  12/22/2008 |
|
Status: Verified
GOAL:
How to determine which persistent procedures are currently running.
GOAL:
How to determine which persistent procedures are currently running on a client.
GOAL:
How to determine which persistent procedures are currently running on an AppServer.
FACT(s) (Environment):
Progress 9.x
OpenEdge 10.x
All Supported Operating Systems
FIX:
Use the SESSION system handle and it's FIRST-PROCEDURE attribute to obtain the handle to the first persistent procedure running in the client session. Use the NEXT-SIBLING attribute of the procedure handle to walk down the procedure chain and obtain information on all persistent procedures in the client session.
To implement this for an AppServer session, use the AppServer's SERVER handle instead of the SESSION system handle.
The following program demonstrates how this works for both the client session and the AppServer session:
/*------------------------------------------------------------------------
File : ShowPersistentProcs.p
Purpose : Example code to show how to determine the persistent
procedures running on an AppServer.
Notes : It is assumed that dummy.p is available in the
working directory of the AppServer. Dummy.p can be any
procedure file, even a completely empty one, since we're
not doing anything with it after running it.
----------------------------------------------------------------------*/
/* Variable definitions */
DEFINE VARIABLE hServer AS HANDLE NO-UNDO.
DEFINE VARIABLE hProcedure AS HANDLE NO-UNDO.
DEFINE VARIABLE cClientProcs AS CHARACTER NO-UNDO.
DEFINE VARIABLE cServerProcs AS CHARACTER NO-UNDO.
/* Connect to AppServer on localhost (test environment) */
CREATE SERVER hServer.
hServer:CONNECT("-H localhost").
/* run the dummy procedure on the AppServer three times. */
RUN dummy.p PERSISTENT ON hServer.
RUN dummy.p PERSISTENT ON hServer.
RUN dummy.p PERSISTENT ON hServer.
/* Get all persistent procedures on the client side (SESSION handle) */
hProcedure = SESSION:FIRST-PROCEDURE.
DO WHILE VALID-HANDLE(hProcedure):
cClientProcs = cClientProcs + hProcedure:FILE-NAME + ",".
hProcedure = hProcedure:NEXT-SIBLING.
END.
/* Get all persistent procedures on the server side, run from the client (server handle) */
hProcedure = hServer:FIRST-PROCEDURE.
DO WHILE VALID-HANDLE(hProcedure):
cServerProcs = cServerProcs + hProcedure:FILE-NAME + ",".
hProcedure = hProcedure:NEXT-SIBLING.
END.
/* Clean up and display the lists of procedures */
ASSIGN cClientProcs = TRIM(cClientProcs,",")
cServerProcs = TRIM(cServerProcs,",").
MESSAGE "Persistent procs. on client: " + cClientProcs
VIEW-AS ALERT-BOX INFO BUTTONS OK.
MESSAGE "Persistent procs. on AppServer: " + cServerProcs
VIEW-AS ALERT-BOX INFO BUTTONS OK.