User: starksm
Date: 02/04/17 13:17:56
Modified: src/main/org/jboss/ejb/plugins Tag: Branch_3_0
AbstractInstanceCache.java EntityInstanceCache.java
StatefulSessionInstanceCache.java
Log:
The NPE in the passivation thread was not fixed by not-nulling the
bean lock manager as it was the container that was null. This is another
fix, but this code needs to be simplified as there are too many indirect
pointers and inner classes to ensure atomic operation of the execute.
Revision Changes Path
No revision
No revision
1.30.2.1 +21 -11 jboss/src/main/org/jboss/ejb/plugins/AbstractInstanceCache.java
Index: AbstractInstanceCache.java
===================================================================
RCS file:
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/AbstractInstanceCache.java,v
retrieving revision 1.30
retrieving revision 1.30.2.1
diff -u -r1.30 -r1.30.2.1
--- AbstractInstanceCache.java 13 Apr 2002 19:54:11 -0000 1.30
+++ AbstractInstanceCache.java 17 Apr 2002 20:17:56 -0000 1.30.2.1
@@ -48,7 +48,7 @@
* @author <a href="[EMAIL PROTECTED]">Bill Burke</a>
* @author <a href="[EMAIL PROTECTED]">Marc Fleury</a>
*
- * @version $Revision: 1.30 $
+ * @version $Revision: 1.30.2.1 $
*
* <p><b>Revisions:</b>
*
@@ -319,9 +319,12 @@
/* From Service interface*/
public void destroy()
{
- getCache().destroy();
+ synchronized (getCacheLock())
+ {
+ getCache().destroy();
+ m_passivationHelper.clear();
+ }
this.m_cache = null;
- m_passivationHelper.clear();
m_passivationHelper = null;
m_buffer.setLength(0);
}
@@ -494,6 +497,19 @@
{
public void execute() throws Exception
{
+ // Validate that the container has not been destroyed
+ Container container = null;
+ BeanLock lock = null;
+ Object id = this.getKey();
+ synchronized (getCacheLock())
+ {
+ container = getContainer();
+ if( container != null )
+ lock = container.getLockManager().getLock(id);
+ }
+ if( container == null )
+ return;
+
if (ctx.getId() == null)
{
// If this happens, then a passivation request for this
bean was issued
@@ -501,7 +517,6 @@
return;
}
- Object id = this.getKey();
/**
* Synchronization / Passivation explanations:
* The instance interceptor (II) first acquires the Sync
object associated
@@ -522,10 +537,9 @@
* marcf: this is still very valid but the first lock is on
the ctx directly
* this is part of the rework of the buzy wait bug
*/
- BeanLock lock = getContainer().getLockManager().getLock(id);
lock.sync();
ClassLoader cl =
Thread.currentThread().getContextClassLoader();
- ClassLoader beanCL = getContainer().getClassLoader();
+ ClassLoader beanCL = container.getClassLoader();
try
{
Thread.currentThread().setContextClassLoader(beanCL);
@@ -613,7 +627,7 @@
{
Thread.currentThread().setContextClassLoader(cl);
lock.releaseSync();
- getContainer().getLockManager().removeLockRef(id);
+ container.getLockManager().removeLockRef(id);
}
}//execute
};// Passivation job definition
@@ -625,11 +639,7 @@
{
if (m_passivationJobs.get(key) == null)
{
- // Register job
- m_passivationJobs.put(key, job);
- // Schedule the job for passivation
- m_passivator.putJob(job);
}
else
{
1.16.2.1 +9 -3 jboss/src/main/org/jboss/ejb/plugins/EntityInstanceCache.java
Index: EntityInstanceCache.java
===================================================================
RCS file:
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityInstanceCache.java,v
retrieving revision 1.16
retrieving revision 1.16.2.1
diff -u -r1.16 -r1.16.2.1
--- EntityInstanceCache.java 13 Apr 2002 18:27:20 -0000 1.16
+++ EntityInstanceCache.java 17 Apr 2002 20:17:56 -0000 1.16.2.1
@@ -20,7 +20,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Simone Bordet</a>
* @author <a href="[EMAIL PROTECTED]">Bill Burke</a>
- * @version $Revision: 1.16 $
+ * @version $Revision: 1.16.2.1 $
*
* <p><b>Revisions:</b>
* <p><b>2001/01/29: billb</b>
@@ -81,7 +81,10 @@
public void destroy()
{
- this.m_container = null;
+ synchronized( this )
+ {
+ this.m_container = null;
+ }
super.destroy();
}
@@ -95,7 +98,10 @@
ctx.setId(id);
}
- protected Container getContainer() {return m_container;}
+ protected synchronized Container getContainer()
+ {
+ return m_container;
+ }
protected void passivate(EnterpriseContext ctx) throws RemoteException
{
1.18.2.1 +9 -2
jboss/src/main/org/jboss/ejb/plugins/StatefulSessionInstanceCache.java
Index: StatefulSessionInstanceCache.java
===================================================================
RCS file:
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/StatefulSessionInstanceCache.java,v
retrieving revision 1.18
retrieving revision 1.18.2.1
diff -u -r1.18 -r1.18.2.1
--- StatefulSessionInstanceCache.java 13 Apr 2002 18:27:20 -0000 1.18
+++ StatefulSessionInstanceCache.java 17 Apr 2002 20:17:56 -0000 1.18.2.1
@@ -27,7 +27,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Simone Bordet</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Sebastien Alborini</a>
- * @version $Revision: 1.18 $
+ * @version $Revision: 1.18.2.1 $
*/
public class StatefulSessionInstanceCache
extends AbstractInstanceCache
@@ -55,6 +55,10 @@
public void destroy()
{
+ synchronized( this )
+ {
+ this.m_container = null;
+ }
m_passivated.clear();
super.destroy();
}
@@ -62,7 +66,10 @@
// Z implementation ----------------------------------------------
// Y overrides ---------------------------------------------------
- protected Container getContainer() {return m_container;}
+ protected synchronized Container getContainer()
+ {
+ return m_container;
+ }
protected void passivate(EnterpriseContext ctx) throws RemoteException
{
m_container.getPersistenceManager().passivateSession((StatefulSessionEnterpriseContext)ctx);
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development