User Session Management for the Dynamic Java Connector
When the connector user successfully signs on, a valid user session is allocated to that user signon. The user session has status for two types of connector operations, one is for inbound business function calls, and the other is for outbound real-time events. The connector monitors the status of the user session and uses the time out settings in the jdeinterop.ini file to stop the user session when a time out setting has been reached. The connector looks at the these settings:
jdeinterop.ini File Section |
Setting |
Explanation |
---|---|---|
[CACHE] |
UserSession |
The maximum connector idle time for an inbound business function call. |
[INTEROP] |
manual_timeout |
The maximum idle time for a manual transaction. |
[EVENTS] |
outbound_timeout |
The maximum value of connector idle time for receiving outbound events. |
The values for the settings are in milliseconds. A value of zero (0) indicates infinite time out. The settings are defined in the jdeinterop.ini section of this guide.
If an inbound user session times out, that user session cannot be used to execute a business function call. Likewise, if an outbound user session times out, that user session cannot be used for events. When both inbound and outbound sessions time out, the user session is removed from the connector. Since each user session has a corresponding handle in the JD Edwards EnterpriseOne server, you should explicitly call a connector API to log off the user session. The API log off releases the handle in the JD Edwards EnterpriseOne server when the user session is no longer used.
This sample code shows how to retrieve and manage a user session:
import com.jdedwards.system.connector.dynamic.Connector; import com.jdedwards.system.connector.dynamic.*; import com.jdedwards.system.connector.dynamic.ServerFailureException; ... // Declare Class public void execMethod() throws ServerFailureException { // Login int sessionID = Connector.getInstance().login("user", "pwd", "env","role"); // Use the sessionID. If InvalidSessionException is caught, user session is not valid any more //Check the status of the usersession UserSession session=null; try { session=Connector.getInstance().getUserSession(sessionID); } catch(InvalidSessionException ex) { System.out.println("Invalid user session"); } if(session.isInboundTimedout()) { System.out.println("User session inbound is timed out"); } if(session.isOutboundTimedout()) { System.out.println("User session outbound is timed out"); } //Log off and shut down connector to release user session from the server Connector.getInstance().logoff(sessionID); Connector.getInstance().shutDown(); }