User: patriot1burke
  Date: 01/06/18 07:56:13

  Modified:    src/main/org/jboss/ejb/plugins AbstractInstanceCache.java
  Log:
  changed canPassivate signature back to original canPassivate(ctx).
  
  Sorry, it was a bad decision to begin with...
  
  In passivation, do check for CacheKeys not being equal within AbstractInstanceCache
  instead.  In the previous version, if CacheKeys were not equal, PassivatorJob
  would check to see if canPassivate was false, if so, re-insert the ctx back
  into the cache.  This was a no-no.
  
  Revision  Changes    Path
  1.10      +14 -6     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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- AbstractInstanceCache.java        2001/06/17 14:57:53     1.9
  +++ AbstractInstanceCache.java        2001/06/18 14:56:13     1.10
  @@ -36,6 +36,7 @@
   import org.jboss.util.Semaphore;
   import org.jboss.ejb.InstanceCache;
   import org.jboss.ejb.EnterpriseContext;
  +import org.jboss.ejb.EntityEnterpriseContext;
   import org.jboss.ejb.DeploymentException;
   import org.jboss.ejb.Container;
   import org.jboss.metadata.MetaData;
  @@ -57,7 +58,7 @@
    *
    * @author Simone Bordet ([EMAIL PROTECTED])
    * @author <a href="[EMAIL PROTECTED]">Bill Burke</a>
  - * @version $Revision: 1.9 $
  + * @version $Revision: 1.10 $
    */
   public abstract class AbstractInstanceCache
        implements InstanceCache, XmlLoadable, Monitorable, MetricsConstants
  @@ -566,11 +567,8 @@
        /**
         * Returns whether the given context can be passivated or not
         *
  -      * (Bill Burke> added key parameter so that canPassivate
  -      * can verify that the object being passivated is really the
  -      * same object and hasn't already been freed then re-used.
         */
  -     protected abstract boolean canPassivate(Object key, EnterpriseContext ctx);
  +     protected abstract boolean canPassivate(EnterpriseContext ctx);
   
        // Private -------------------------------------------------------
   
  @@ -649,7 +647,17 @@
                                                            
                                                            synchronized (this)
                                                            {
  -                                                             if (!canPassivate(id, 
ctx))
  +                                                             if (ctx instanceof 
EntityEnterpriseContext)
  +                                                             {
  +                                                                 // Verify that 
this ctx hasn't already
  +                                                                 // been freed and 
re-used by another thread.
  +                                                                 if 
(!((EntityEnterpriseContext)ctx).getCacheKey().equals(id))
  +                                                                 {
  +                                                                     // ctx has 
been freed then re-used in another thread.
  +                                                                     return;
  +                                                                 }
  +                                                             }
  +                                                             if (!canPassivate(ctx))
                                                                {
                                                                    // This check is 
done because there could have been
                                                                    // a request for 
passivation of this bean, but before
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to