Subject Multiple transactions over single socket [Fwd: fb: r6346 - in trunk/rdb_2_1/jaybird/src: main/org/firebirdsql/jca test/org/firebirdsql/jca]
Author Nikolay Samofatov
Hello, Roman!

Attached is the code from Eugene Putilin as applied to RDB 2.1 trunk.
We integrated the use of this feature into our framework (ncore) and the
code appears to work.
The presense of subj capability is critical for our deliverable. I guess
it can be useful for other people as well.

The code apparently needs a bit of polishing before it can be applied to
Jaybird HEAD.
Please let us know what you think.

Nikolay

-------- Original Message --------
Subject: fb: r6346 - in trunk/rdb_2_1/jaybird/src:
main/org/firebirdsql/jca test/org/firebirdsql/jca
Date: Mon, 2 Nov 2009 04:08:12 +0300 (MSK)
From: SVNMailer@...
To: roman.simakov at red-soft.biz, dmitry.starodubov at red-soft.biz,
artyom.smirnov at red-soft.biz, pavel.maslov at red-soft.biz,
nikolay.samofatov at red-soft.biz, roman.kisluhin at red-soft.biz



Author: skidder
Date: 2009-11-02 04:08:11 +0300 (Mon, 02 Nov 2009)
New Revision: 6346

Added:
trunk/rdb_2_1/jaybird/src/main/org/firebirdsql/jca/FBSADataSource.java
trunk/rdb_2_1/jaybird/src/test/org/firebirdsql/jca/TestFBSADataSource.java
Modified:
trunk/rdb_2_1/jaybird/src/main/org/firebirdsql/jca/FBManagedConnection.java
Log:
Add code from Putilin to allow multiple transactions per physical attachment

Modified: trunk/rdb_2_1/jaybird/src/main/org/firebirdsql/jca/FBManagedConnection.java
===================================================================
--- trunk/rdb_2_1/jaybird/src/main/org/firebirdsql/jca/FBManagedConnection.java 2009-11-01 19:02:38 UTC (rev 6345)
+++ trunk/rdb_2_1/jaybird/src/main/org/firebirdsql/jca/FBManagedConnection.java 2009-11-02 01:08:11 UTC (rev 6346)
@@ -62,6 +62,7 @@
private GDS gds;
private IscDbHandle dbHandle;
private GDSHelper gdsHelper;
+ private FBManagedConnection parent;

private FBConnectionRequestInfo cri;
private FBTpb tpb;
@@ -92,6 +93,28 @@
}
}

+
+ private FBManagedConnection(FBManagedConnection mc)
+ {
+ this.parent = mc;
+ this.mcf = mc.mcf;
+ this.gds = mc.gds;
+ this.cri = mc.cri;
+ this.tpb = mc.tpb;
+ this.transactionIsolation = mc.transactionIsolation;
+ this.dbHandle = mc.dbHandle;
+
+ DatabaseParameterBuffer dpb = this.cri.getDpb();
+
+ this.gdsHelper = new GDSHelper(this.gds, dpb, (AbstractIscDbHandle)this.dbHandle, this);
+ }
+
+
+ public FBManagedConnection forkManagedConnection()
+ {
+ return new FBManagedConnection(parent != null ? parent : this);
+ }
+
/**
* Notify GDS container that error occured, if the <code>ex</code>
* represents a "fatal" one
@@ -414,7 +437,7 @@
private void disassociateConnections() throws ResourceException {

ResourceException ex = null;
-
+ ArrayList connectionHandles = new ArrayList (this.connectionHandles);
for (Iterator i = connectionHandles.iterator(); i.hasNext();) {
AbstractConnection connection = (AbstractConnection) i.next();

@@ -428,7 +451,7 @@
}
}

- connectionHandles.clear();
+ this.connectionHandles.clear();

if (ex != null)
throw ex;
@@ -511,6 +534,8 @@
throw new java.lang.IllegalStateException(
"Can't destroy managed connection with active transaction");

+ if (parent != null)
+ return;
try {
gdsHelper.detachDatabase();
} catch (GDSException ge) {


Property changes on: trunk/rdb_2_1/jaybird/src/main/org/firebirdsql/jca/FBSADataSource.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native


Property changes on: trunk/rdb_2_1/jaybird/src/test/org/firebirdsql/jca/TestFBSADataSource.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native



--
Nikolay Samofatov, MBA
Red Soft Corporation
+7 495 668 3735



[Non-text portions of this message have been removed]