You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by ti...@apache.org on 2016/05/20 09:05:24 UTC

svn commit: r1744676 - /aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/ScopedWorkException.java

Author: timothyjward
Date: Fri May 20 09:05:24 2016
New Revision: 1744676

URL: http://svn.apache.org/viewvc?rev=1744676&view=rev
Log:
[tx-control] Mark ScopedWorkException#context as transient so the Exception can be serialized

Modified:
    aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/ScopedWorkException.java

Modified: aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/ScopedWorkException.java
URL: http://svn.apache.org/viewvc/aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/ScopedWorkException.java?rev=1744676&r1=1744675&r2=1744676&view=diff
==============================================================================
--- aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/ScopedWorkException.java (original)
+++ aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/ScopedWorkException.java Fri May 20 09:05:24 2016
@@ -15,6 +15,8 @@
  */
 package org.osgi.service.transaction.control;
 
+import java.io.Serializable;
+
 /**
  * An Exception that is thrown when a piece of scoped work exits with an
  * {@link Exception}
@@ -25,7 +27,13 @@ public class ScopedWorkException extends
 	 */
 	private static final long			serialVersionUID	= 4160254161503114842L;
 
-	private final TransactionContext context;
+	/**
+	 * {@link TransactionContext} instances are not required to 
+	 * be {@link Serializable}, and the ongoing context is very 
+	 * unlikely to be active post deserialization. As a result
+	 * this field is transient.
+	 */
+	private transient final TransactionContext context;
 
 	/**
 	 * Creates a new TransactionException with the supplied message and cause
@@ -40,7 +48,9 @@ public class ScopedWorkException extends
 	}
 
 	/**
-	 * @return The ongoing transaction context if the scope is still active
+	 * @return The ongoing transaction context if the current scope was still 
+	 *         active when this exception was raised or <code>null</code> otherwise.
+	 *         Note that this property will not be persisted during serialization.
 	 */
 	public TransactionContext ongoingContext() {
 		return context;