[jboss-svn-commits] JBL Code SVN: r31199 - in labs/jbosstm/branches/JBOSSTS_4_2_3_GA_CP: ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/resources/jts/orbspecific and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Jan 25 09:15:28 EST 2010
Author: jhalliday
Date: 2010-01-25 09:15:28 -0500 (Mon, 25 Jan 2010)
New Revision: 31199
Modified:
labs/jbosstm/branches/JBOSSTS_4_2_3_GA_CP/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/resources/arjunacore/XAResourceRecord.java
labs/jbosstm/branches/JBOSSTS_4_2_3_GA_CP/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/resources/jts/orbspecific/XAResourceRecord.java
Log:
Backport XAResourceRecord save/restore fix to 4.2.3.CP branch. JBTM-377
Modified: labs/jbosstm/branches/JBOSSTS_4_2_3_GA_CP/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/resources/arjunacore/XAResourceRecord.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_2_3_GA_CP/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/resources/arjunacore/XAResourceRecord.java 2010-01-25 06:25:29 UTC (rev 31198)
+++ labs/jbosstm/branches/JBOSSTS_4_2_3_GA_CP/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/resources/arjunacore/XAResourceRecord.java 2010-01-25 14:15:28 UTC (rev 31199)
@@ -874,45 +874,37 @@
{
os.packInt(RecoverableXAConnection.OBJECT_RECOVERY);
- boolean shouldSerialize = false;
-
- try
- {
- if (_theXAResource instanceof Serializable)
- shouldSerialize = true;
-
- ByteArrayOutputStream s = new ByteArrayOutputStream();
- ObjectOutputStream o = new ObjectOutputStream(s);
-
- // don't allow the packing of a null resource
-
- if (_theXAResource == null)
- throw new NotSerializableException();
-
- o.writeObject(_theXAResource);
- o.close();
-
- os.packBoolean(true);
-
- os.packBytes(s.toByteArray());
- }
- catch (NotSerializableException ex)
- {
- if (!shouldSerialize)
- {
- // have to rely upon XAResource.recover!
-
- os.packBoolean(false);
- }
- else
- {
- if (jtaLogger.loggerI18N.isWarnEnabled())
- {
- jtaLogger.loggerI18N
- .warn("com.arjuna.ats.internal.jta.resources.arjunacore.savestate");
- }
- }
- }
+ if (_theXAResource instanceof Serializable)
+ {
+ try
+ {
+ ByteArrayOutputStream s = new ByteArrayOutputStream();
+ ObjectOutputStream o = new ObjectOutputStream(s);
+
+ o.writeObject(_theXAResource);
+ o.close();
+
+ os.packBoolean(true);
+
+ os.packBytes(s.toByteArray());
+ }
+ catch (NotSerializableException ex)
+ {
+ if (jtaLogger.loggerI18N.isWarnEnabled())
+ {
+ jtaLogger.loggerI18N
+ .warn("com.arjuna.ats.internal.jta.resources.arjunacore.savestate");
+ }
+
+ return false;
+ }
+ }
+ else
+ {
+ // have to rely upon XAResource.recover!
+
+ os.packBoolean(false);
+ }
}
else
{
@@ -932,7 +924,7 @@
}
if (res)
- res = res && super.save_state(os, t);
+ res = super.save_state(os, t);
return res;
}
@@ -1022,9 +1014,7 @@
* try to get a new XAResource later for this instance.
*/
- return true;
-
- //return false;
+ res = true;
}
}
}
@@ -1059,7 +1049,7 @@
}
if (res)
- res = res && super.restore_state(os, t);
+ res = super.restore_state(os, t);
return res;
}
Modified: labs/jbosstm/branches/JBOSSTS_4_2_3_GA_CP/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/resources/jts/orbspecific/XAResourceRecord.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_2_3_GA_CP/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/resources/jts/orbspecific/XAResourceRecord.java 2010-01-25 06:25:29 UTC (rev 31198)
+++ labs/jbosstm/branches/JBOSSTS_4_2_3_GA_CP/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/resources/jts/orbspecific/XAResourceRecord.java 2010-01-25 14:15:28 UTC (rev 31199)
@@ -881,42 +881,37 @@
if (_recoveryObject == null)
{
os.packInt(RecoverableXAConnection.OBJECT_RECOVERY);
-
- boolean shouldSerialize = false;
- try
- {
- if (_theXAResource instanceof Serializable)
- shouldSerialize = true;
-
- ByteArrayOutputStream s = new ByteArrayOutputStream();
- ObjectOutputStream o = new ObjectOutputStream(s);
+ if (_theXAResource instanceof Serializable)
+ {
+ try
+ {
+ ByteArrayOutputStream s = new ByteArrayOutputStream();
+ ObjectOutputStream o = new ObjectOutputStream(s);
+
+ o.writeObject(_theXAResource);
+ o.close();
+
+ os.packBoolean(true);
+
+ os.packBytes(s.toByteArray());
+ }
+ catch (NotSerializableException ex)
+ {
+ if (jtaLogger.loggerI18N.isWarnEnabled())
+ {
+ jtaLogger.loggerI18N.warn("com.arjuna.ats.internal.jta.resources.jts.orbspecific.saveState");
+ }
- o.writeObject(_theXAResource);
- o.close();
-
- os.packBoolean(true);
-
- os.packBytes(s.toByteArray());
- }
- catch (NotSerializableException ex)
- {
- if (!shouldSerialize)
- {
- // have to rely upon XAResource.recover!
-
- os.packBoolean(false);
- }
- else
- {
- if (jtaLogger.loggerI18N.isWarnEnabled())
- {
- jtaLogger.loggerI18N.warn("com.arjuna.ats.internal.jta.resources.jts.orbspecific.saveState");
- }
-
- return false;
- }
- }
+ return false;
+ }
+ }
+ else
+ {
+ // have to rely upon XAResource.recover!
+
+ os.packBoolean(false);
+ }
}
else
{
More information about the jboss-svn-commits
mailing list