The UDTT JCA LU0 Connector does not support the 1-1 session binding by UDTT product itself. It means that the application cannot specify and stick on the particular LU when there are many LUs or LU pools defined.
RUI_INIT API of SNA will return a different free LU if the specified LU is already used. And, in some cases, the specified LU name might be a LU pool. Then the JCA LU0 Connector will return an actual LU name for a LU0 connection request. Application can use the SYNC_GET_ACTUAL_LU_NAME verb to get the actual LU name.
However, the application supports 1-1 session binding based on UDTT JCA LU0 and manages it by the application code.
The property of JCA LU0 is defined in custom property of J2C connection factory in the Administrative Console of the WebSphere Application Server (WAS). It cannot bind with context. Besides, there is no automatic start up process when UDTT or WAS is started.
According to the JCA specification, the JCA connection factory that is defined in J2C WAS console with a JNDI name, gets the JCA LU0 connection. The JCA connection will be created or retrieved from WAS connection pool only upon the connection request from the application.
The automaticSessionEstablishment property of JCA LU0 only means that when the existing session is down, the session will be reestablished automatically.
Below is the session 1-1 binding sample for the case when there are multiple users and multiple LUs, and you need to bind a client with a LU. It means that after a session or connection is got from the connection factory for a client, the following communication request for this client is bind with the obtained LU.
Definition:
In the communication server, define a LU pool named LU0POOL with the LUs: LU01, LU02, LU03..LUn.
In the J2C connection factory in WAS, create a LU0 connection factory with JNDI name: LU0SNA.
For connection factory custom property definition, you can define it in the following two ways:
▪ luNames : LU01, LU02, LU03, LU04... LUn
poolNameUsed: false
▪ luNames : LU0POOL
poolNameUsed: true
Implementation:
Hashtable userConnectionTab=new Hashtable(); Hashtable userLuNameTab=new Hashtable(); ....... public Connection getConnectionForUser(String userID){ if (userConnectionTab.get(userID)!=null) { return (Connection) userConnectionTab.get(userID) ; } else { javax.naming.Context initialContext = new javax.naming.InitialContext(); ConnectionFactory connectionFactory = (ConnectionFactory) initialContext.lookup("LU0SNA"); Connection connection = connectionFactory.getConnection(); // get the LU name of the obtained connection Interaction interaction = connection.createInteraction(); Lu0InteractionSpec interactionSpec = new Lu0InteractionSpec(); interactionSpec.setInteractionVerb(Lu0InteractionSpec.SYNC_GET_ACTUAL_LU_NAME); Lu0Record out = new Lu0Record(); interaction.execute(interactionSpec, null, out); String luName=out.getData(); // bind the connection and LU name with userID userConnectionTab.put(userID,connection); userLuNameTab.put(userID,luName) ; return connection;
Interaction interaction = connection.createInteraction(); Lu0InteractionSpec interactionSpec = new Lu0InteractionSpec(); interactionSpec.setInteractionVerb(interactionSpec.SYNC_SEND); Lu0Record in = new Lu0Record(); Lu0Record out = new Lu0Record(); in.setData("AIR2TO "); interaction.execute(interactionSpec, in, null); interactionSpec.setInteractionVerb(interactionSpec.SYNC_RECEIVE); interactionSpec.setExecutionTimeout(1000); interaction.execute(interactionSpec, null, out); System.out.println("Data received: " + out.getData()); //only close interaction, Should NOT close connection interaction.close(); }