[jboss-user] [IronJacamar] - Re: "getConnection" returns a shared connection regardless of the sharable property in the resource reference and regardless of the connection request info

berw do-not-reply at jboss.com
Mon Aug 12 09:26:44 EDT 2013


berw [https://community.jboss.org/people/berw] created the discussion

"Re: "getConnection" returns a shared connection regardless of the sharable property in the resource reference and regardless of the connection request info"

To view the discussion, visit: https://community.jboss.org/message/832320#832320

--------------------------------------------------------------
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;+
+    }+
+}+
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/832320#832320]

Start a new discussion in IronJacamar at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2098]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20130812/45c8bb8e/attachment-0001.html 


More information about the jboss-user mailing list