Dear Experts,
I am trying to write a custom resource adapter. But met some problems, so I re-run the example provided by Glassfish to test if has the same issue. when I run the ‘traffic’ example, Also I found it can’t release connection correctly after I set the attribute ‘maxPoolSize’ attribute of @ConnectionFactoryDefinition. If I set this attribute to 5, that means I can only use factory to get connection 5 times. In the 6th, system will hang up and will get error message later. Even I have released connection in time.
For the ‘ trading' example bundled with Glassfish, I just change one place.(the project is under <glassfish_home>/docs/javaee-tutorial/examples/connectors/trading)
the original definition in ‘ResourceAccessBean’class is as below:
@ConnectionFactoryDefinition(
name = "java:comp/env/eis/TradeConnectionFactory",
interfaceName = "javaeetutorial.trading.rar.api.TradeConnectionFactory",
resourceAdapter = "#trading-rar",
minPoolSize = 5,
transactionSupport =
TransactionSupport.TransactionSupportLevel.NoTransaction
)
and I just add one more attribute of it as below:
@ConnectionFactoryDefinition(
name = "java:comp/env/eis/TradeConnectionFactory",
interfaceName = "javaeetutorial.trading.rar.api.TradeConnectionFactory",
resourceAdapter = "#trading-rar",
minPoolSize = 5,
maxPoolSize = 10,
transactionSupport =
TransactionSupport.TransactionSupportLevel.NoTransaction
)
And this is the only place I modified, after changing, I refresh the browser and repeat to click button ‘connect' and ‘disconnect’. When the 11th, the browser hang up, and display error message later:
Error in allocating a connection. Cause: In-use connections equal max-pool-size and expired max-wait-time. Cannot allocate more connections.
Since I haven’t change other code, and just run example bundled with Glassfish, So I think maybe there exist some bugs that not properly release connection.
Can anybody help me to take a look at this issue? Thank you very much!
My Environment:
Glassfish 4.1 (build 13)
Oracle Java 1.7.0_51-b13
########################
William
System Architect
streetpoet_at_163.com
########################