Try OpenEdge Now
skip to main content
Developing AppServer Applications
Programming ABL Client Applications : Disconnecting from an AppServer instance : Disconnecting from a session-free application service
 

Disconnecting from a session-free application service

The following example shows how a client application can disconnect from a session-free application service:
DEFINE VARIABLE hInventory AS HANDLE NO-UNDO.
DEFINE VARIABLE lReturn    AS LOGICAL NO-UNDO.

CREATE SERVER hInventory.
lReturn = hInventory:CONNECT("-AppService inventory -S 5163 -H 4glServices
  -sessionModel Session-free -initialConnections 25").
IF NOT lReturn THEN DO:
  DELETE OBJECT hInventory NO-ERROR.
  RETURN ERROR "Failed to connect to Inventory application service".
END.
IF ERROR-STATUS:ERROR THEN DO:
  lReturn = hInventory:DISCONNECT().
  DELETE OBJECT hInventory NO-ERROR.
  RETURN ERROR RETURN-VALUE.
END.
. . .
lReturn = hInventory:DISCONNECT().
DELETE OBJECT hInventory NO-ERROR.
When the DISCONNECT( ) method executes, the client application disconnects all physical connections to AppServer brokers in the connection pool for the application service referenced by the hInventory handle. When the disconnection request completes, you can send no more remote requests using the disconnected server handle.