-
1. Re: "getConnection" returns a shared connection regardless of the sharable property in the resource reference and regardless of the connection request info
jesper.pedersen Aug 12, 2013 9:10 AM (in response to berw)Well, you didn't post any configuration, so I'm guessing the wrong way Do you have <security><application/></security> ?
-
2. Re: "getConnection" returns a shared connection regardless of the sharable property in the resource reference and regardless of the connection request info
berw Aug 12, 2013 9:26 AM (in response to jesper.pedersen)Ok, what do you need to see?
The resourceReference in the DD of the using EJB (the client) looks like this:
<session id="PCEXMLExchangeRateImportImpl">
<ejb-name>PCEXMLExchangeRateImportImpl</ejb-name>
<local-home>com.myproclassic.server.services.exchangerate.importer.PCEExchangeRateImportImplLocalHome</local-home>
<local>com.myproclassic.server.services.exchangerate.importer.PCEExchangeRateImportImplLocal</local>
<ejb-class>com.myproclassic.server.services.exchangerate.importer.xml.PCEXMLExchangeRateImportImplBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
<resource-ref id="ResourceRef_RaFile">
<description>
</description>
<res-ref-name>res/PCERAFile</res-ref-name>
<res-type>javax.resource.cci.ConnectionFactory</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Unshareable</res-sharing-scope>
</resource-ref>
</session>
The client code looks like this:
PCERAFileConnectionRequestInfo requestInfoTemp = new PCERAFileConnectionRequestInfo(newName, "rw"); // newName is different at the second call within the same transaction.
fileConnection = (PCERAFileConnection) raFileConnectionFactory.getConnection(requestInfoTemp);
if (fileConnection != null)
return fileConnection.getRandomAccessFile();
The connectionRequestInfo looks like this:
package com.wincor.jca;
import javax.resource.cci.ConnectionSpec;
import javax.resource.spi.ConnectionRequestInfo;
public class PCERAFileConnectionRequestInfo implements ConnectionRequestInfo, ConnectionSpec {
private String fileName = "";
private String openMode = "";
public PCERAFileConnectionRequestInfo(String fileName, String openMode) {
this.fileName = fileName;
this.openMode = openMode;
}
public int hashCode() {
return fileName.hashCode() + openMode.hashCode();
}
public boolean equals(Object obj) {
boolean result = false;
if (obj != null) {
if (obj instanceof PCERAFileConnectionRequestInfo) {
result = ((PCERAFileConnectionRequestInfo) obj).getFileName().equals(fileName) && ((PCERAFileConnectionRequestInfo) obj).getOpenMode().equals(openMode);
}
}
return result;
}
public String getFileName() {
return fileName;
}
public String getOpenMode() {
return openMode;
}
}
-
3. Re: "getConnection" returns a shared connection regardless of the sharable property in the resource reference and regardless of the connection request info
jesper.pedersen Aug 12, 2013 9:30 AM (in response to berw)It was more the configuration of the :resource-adapters: subsystem. However, you maybe running into https://issues.jboss.org/browse/JBEAP-24
-
4. Re: "getConnection" returns a shared connection regardless of the sharable property in the resource reference and regardless of the connection request info
berw Aug 12, 2013 10:21 AM (in response to jesper.pedersen)There are some JCA connectors in the configuration but the one that keeps me busy is not configured there. It has an ironjacamar.xml file in its META-INF folder. Isn't that a way to configure it?
<?xml version="1.0" encoding="UTF-8"?>
<p:ironjacamar xmlns:p="http://www.jboss.org/ironjacamar/schema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.org/ironjacamar/schema http://www.jboss.org/ironjacamar/schema ">
<p:connection-definitions>
<p:connection-definition
jndi-name="java:/PCERAFile"
class-name="com.wincor.jca.PCERAFileManagedConnectionFactory">
</p:connection-definition>
</p:connection-definitions>
</p:ironjacamar>
-
5. Re: "getConnection" returns a shared connection regardless of the sharable property in the resource reference and regardless of the connection request info
jesper.pedersen Aug 12, 2013 10:25 AM (in response to berw)That is ok.
However, there won't be any run-time manament of the resource. So depends if you need that or not... Only :resource-adapters: has it.
-
6. Re: "getConnection" returns a shared connection regardless of the sharable property in the resource reference and regardless of the connection request info
berw Aug 12, 2013 10:57 AM (in response to jesper.pedersen)OK it works now. The problem was a missing setting for min and max pool size in the ironjacamar.xml. That seems to cause the use of the "OnePool". The "OnePool" implementation seems to ignore the ConnectionRequestInfo. Dont know whether it should better raise a ResourceException?
Hopefully the currently used pool implementation takes the CRI into account and it does not work by accident now (just by having more choice?)
Anyways, I really appreciate your help!
Thank you very much and best regards,
Wolfgang
Looks like this now:
<?xml version="1.0" encoding="UTF-8"?>
<p:ironjacamar xmlns:p="http://www.jboss.org/ironjacamar/schema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.org/ironjacamar/schema http://www.jboss.org/ironjacamar/schema ">
<p:connection-definitions>
<p:connection-definition
jndi-name="java:/PCERAFile"
class-name="com.wincor.jca.PCERAFileManagedConnectionFactory">
<p:pool>
<p:min-pool-size>10</p:min-pool-size>
<p:max-pool-size>100</p:max-pool-size>
</p:pool>
<p:security>
<p:application/>
</p:security>
</p:connection-definition>
</p:connection-definitions>
</p:ironjacamar>
-
7. Re: "getConnection" returns a shared connection regardless of the sharable property in the resource reference and regardless of the connection request info
jesper.pedersen Aug 12, 2013 10:59 AM (in response to berw)No, the missing <security><application/></security> causes that. Adding that and you will get a pool which looks at the CRI objects.
-
8. Re: "getConnection" returns a shared connection regardless of the sharable property in the resource reference and regardless of the connection request info
berw Aug 12, 2013 11:08 AM (in response to jesper.pedersen)OK, got it! Thanks again.