[jboss-user] [JCA/JBoss] - Re: issues with JCA minimum connections
tvbinh
do-not-reply at jboss.com
Mon Feb 18 01:09:11 EST 2008
Hi Vicky,
Thank you very much for your help,
anonymous wrote : 1) How are you getting the Connection Handle from the ConnectionFactory ? Are you passing the CRI details to the Connection Handle through the application code?
|
No, I declare all the properties in -ds.xml file e.g. and JBoss will read those. I prefer this way to hard coding properties into the codes. Below is the content of my -ds.xml
sampleds.xml
<connection-factories>
| <no-tx-connection-factory>
| <jndi-name>SimplewireDS</jndi-name>
| <rar-name>65-mitto-ra-smpp.rar</rar-name>
| <connection-definition>
| com.smsc.mitto.ra.smpp.SMPPConnectionFactory
| </connection-definition>
| <config-property name="Name" type="java.lang.String">Mitto-1</config-property>
| <config-property name="Server" type="java.lang.String">192.168.2.115</config-property>
| <config-property name="Port" type="java.lang.Integer">9999</config-property>
| <config-property name="Username" type="java.lang.String">binh</config-property>
| <config-property name="Password" type="java.lang.String">binh</config-property>
| <min-pool-size>0</min-pool-size>
| <max-pool-size>4</max-pool-size>
| <idle-timeout-minutes>525600</idle-timeout-minutes> <!-- if idle for a year reconnect... -->
| <blocking-timeout-millis>100</blocking-timeout-millis>
| <prefill>true</prefill>
| </no-tx-connection-factory>
| </connection-factories>
The properties are loaded in my <managed-connection-factory> class
public Object createConnectionFactory(ConnectionManager connectionManager)
| throws ResourceException {
| logger
| .info("Creating connection factory (with specified connectionmanager) in TelnetManagedConnectionfactory with id="
| + id);
|
| // At this stage the values from the configuration file should have been
| // set
| if (server != null && port != 0 && username != null && password != null
| && name != null) {
| SMPPRequestInfo smppInfo;
|
| smppInfo = new SMPPRequestInfo(username, password, server, port,
| name);
| return new SMPPConnectionFactoryImpl(connectionManager, this,
| smppInfo);
| } else
| throw new ResourceException();
| }
|
| public void setUsername(String username) {
| this.username = username;
| }
|
| public void setPassword(String password) {
| this.password = password;
| }
|
| public void setServer(String server) {
| this.server = server;
| }
|
| public void setPort(Integer port) {
| this.port = port;
| }
|
| public void setName(String name) {
| this.name = name;
| }
|
anonymous wrote : 2/ Verify if the <connectionfactory-impl-class> implementation are passsing the ConnectionRequestInfo appropriately when asked to .
| Look at the jdbc resource adapter implemetaion of the connectionfactory-impl-class here
|
| Since I declare all the properties in -ds.xml, I would probably not need to pass the ConnectionRequestInfo in my <connection-factory-impl> class. Here is the codes:
| public SMPPConnection getConnection() throws NamingException {
| logger
| .info("Request an SMPPConnection from the SMPPConnectionFactoryImpl with id="
| + id);
| SMPPConnectionImpl tc = null;
| try {
| tc = (SMPPConnectionImpl) manager.allocateConnection(factory,
| smppInfo);
| return tc;
| } catch (ResourceException ex) {
| // doing something
| }
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4130008#4130008
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4130008
More information about the jboss-user
mailing list