User: fleury
Date: 00/10/14 00:38:35
Modified: src/main/org/jboss/ejb/plugins
EntitySynchronizationInterceptor.java
Log:
forgot to reset the CL
Revision Changes Path
1.23 +36 -21
jboss/src/main/org/jboss/ejb/plugins/EntitySynchronizationInterceptor.java
Index: EntitySynchronizationInterceptor.java
===================================================================
RCS file:
/products/cvs/ejboss/jboss/src/main/org/jboss/ejb/plugins/EntitySynchronizationInterceptor.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- EntitySynchronizationInterceptor.java 2000/10/14 07:21:57 1.22
+++ EntitySynchronizationInterceptor.java 2000/10/14 07:38:34 1.23
@@ -48,7 +48,7 @@
* @see <related>
* @author Rickard �berg ([EMAIL PROTECTED])
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
-* @version $Revision: 1.22 $
+* @version $Revision: 1.23 $
*/
public class EntitySynchronizationInterceptor
extends AbstractInterceptor
@@ -336,13 +336,16 @@
public void beforeCompletion()
{
// DEBUG Logger.debug("beforeCompletion called for ctx
"+ctx.hashCode());
-
- // This is an independent point of entry. We need to make sure
the
- // thread is associated with the right context class loader
-
Thread.currentThread().setContextClassLoader(container.getClassLoader());
-
+
if (ctx.getId() != null) {
+
+ // This is an independent point of entry. We need to
make sure the
+ // thread is associated with the right context class loader
+ ClassLoader oldCl =
Thread.currentThread().getContextClassLoader();
+
Thread.currentThread().setContextClassLoader(container.getClassLoader());
+
try {
+
try {
// MF FIXME: should we throw an
exception if lock is present (app error)
@@ -353,8 +356,6 @@
//DEBUG
Logger.debug("EntitySynchronization sync calling store on ctx "+ctx.hashCode());
-//DEBUG
Logger.debug("EntitySynchronization sync calling store on ctx "+ctx.hashCode());
-
// Check isModified bean flag
boolean dirty = true;
if (isModified != null)
@@ -375,7 +376,8 @@
} catch (NoSuchEntityException e) {
// Object has been removed -- ignore
}
- } catch (RemoteException e) {
+ }
+ catch (RemoteException e) {
Logger.exception(e);
// Store failed -> rollback!
@@ -386,30 +388,38 @@
} catch (IllegalStateException ex) {
// DEBUG ex.printStackTrace();
}
+ }
+ finally {
+
+
Thread.currentThread().setContextClassLoader(oldCl));
}
}
}
+
+ public void afterCompletion(int status)
+ {
- public void afterCompletion(int status)
- {
-
- // This is an independent point of entry. We need to make sure
the
- // thread is associated with the right context class loader
-
Thread.currentThread().setContextClassLoader(container.getClassLoader());
+ // This is an independent point of entry. We need to make sure the
+ // thread is associated with the right context class loader
+ ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
+
Thread.currentThread().setContextClassLoader(container.getClassLoader());
+
+ if (ctx.getId() != null) {
- if (ctx.getId() != null) {
+ try {
//DEBUG Logger.debug("afterCompletion called for ctx
"+ctx.hashCode());
// If rolled back -> invalidate instance
if (status == Status.STATUS_ROLLEDBACK) {
+
try {
// finish the transaction association
ctx.setTransaction(null);
ctx.setValid(false);
-
+
// remove from the cache
container.getInstanceCache().remove(ctx.getId());
@@ -423,8 +433,6 @@
// Ignore
}
-
-
} else {
// The transaction is done
ctx.setTransaction(null);
@@ -462,10 +470,17 @@
}
break;
}
+
}
+ }
+
+ finally {
+
+ Thread.currentThread().setContextClassLoader(oldCl);
+
+ // Notify all who are waiting for this tx to end, they
are waiting since the locking logic
+ synchronized (ctx) {ctx.notifyAll();}
}
- // Notify all who are waiting for this tx to end, they are
waiting since the locking logic
- synchronized (ctx) {ctx.notifyAll();}
}
}
}
- [jBoss-Dev] CVS update: jboss/src/main/org/jboss/ejb... jBoss CVS Development
- [jBoss-Dev] CVS update: jboss/src/main/org/jboss/ejb... jBoss CVS Development
- [jBoss-Dev] CVS update: jboss/src/main/org/jboss/ejb... jBoss CVS Development
- [jBoss-Dev] CVS update: jboss/src/main/org/jboss/ejb... jBoss CVS Development
- [jBoss-Dev] CVS update: jboss/src/main/org/jboss/ejb... jBoss CVS Development
- [jBoss-Dev] CVS update: jboss/src/main/org/jboss/ejb... jBoss CVS Development
- [jBoss-Dev] CVS update: jboss/src/main/org/jboss/ejb... jBoss CVS Development
- [jBoss-Dev] CVS update: jboss/src/main/org/jboss/ejb... jBoss CVS Development
- [jBoss-Dev] CVS update: jboss/src/main/org/jboss/ejb... jBoss CVS Development
- [jBoss-Dev] CVS update: jboss/src/main/org/jboss/ejb... jBoss CVS Development
- [jBoss-Dev] CVS update: jboss/src/main/org/jboss/ejb... jBoss CVS Development
- [jBoss-Dev] CVS update: jboss/src/main/org/jboss/ejb... jBoss CVS Development
- [jBoss-Dev] CVS update: jboss/src/main/org/jboss/ejb... jBoss CVS Development
- [jBoss-Dev] CVS update: jboss/src/main/org/jboss/ejb... jBoss CVS Development
- [jBoss-Dev] CVS update: jboss/src/main/org/jboss/ejb... jBoss CVS Development
- [jBoss-Dev] CVS update: jboss/src/main/org/jboss/ejb... jBoss CVS Development
- [jBoss-Dev] CVS update: jboss/src/main/org/jboss/ejb... jBoss CVS Development
