User: patriot1burke
  Date: 01/06/15 16:35:05

  Modified:    src/main/org/jboss/ejb/plugins AbstractInstanceCache.java
  Log:
  We can't rely on the EnterpriseContext to provide PassivationJob
  with a valid key because it may get freed to the InstancePool, then
  reused before the PassivationJob executes.
  
  So, PassivationJob's constructor now requires the EnterpriseContext's key
  as a parameter.
  
  Revision  Changes    Path
  1.8       +21 -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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- AbstractInstanceCache.java        2001/06/11 19:52:26     1.7
  +++ AbstractInstanceCache.java        2001/06/15 23:35:05     1.8
  @@ -56,7 +56,8 @@
    * </ul>
    *
    * @author Simone Bordet ([EMAIL PROTECTED])
  - * @version $Revision: 1.7 $
  + * @author <a href="[EMAIL PROTECTED]">Bill Burke</a>
  + * @version $Revision: 1.8 $
    */
   public abstract class AbstractInstanceCache
        implements InstanceCache, XmlLoadable, Monitorable, MetricsConstants
  @@ -592,13 +593,16 @@
                        Object key = getKey(bean);
                        if (m_passivationJobs.get(key) == null)
                        {
  -                             // Create the passivation job
  -                             PassivationJob job = new PassivationJob(bean)
  +                             // (Bill Burke) We can't rely on the EnterpriseContext 
to provide PassivationJob
  +                             // with a valid key because it may get freed to the 
InstancePool, then
  +                             // reused before the PassivationJob executes.
  +                             //
  +                             PassivationJob job = new PassivationJob(bean, key)
                                {
                                        public void execute() throws Exception
                                        {
  -                                             EnterpriseContext ctx = 
getEnterpriseContext();
  -                                             Object id = getKey(ctx);
  +                                             EnterpriseContext ctx = 
this.getEnterpriseContext();
  +                                             Object id = this.getKey();
   
                                                if (id == null)
                                                {
  @@ -762,16 +766,27 @@
   abstract class PassivationJob implements Executable
   {
        private EnterpriseContext m_context;
  +     private Object m_key;
        private boolean m_cancelled;
        private boolean m_executed;
   
  -     PassivationJob(EnterpriseContext ctx)
  +     PassivationJob(EnterpriseContext ctx, Object key)
        {
                m_context = ctx;
  +             m_key = key;
        }
   
        public abstract void execute() throws Exception;
   
  +        /**
  +      * (Bill Burke) We can't rely on the EnterpriseContext to provide 
PassivationJob
  +      * with a valid key because it may get freed to the InstancePool, then
  +      * reused before the PassivationJob executes.
  +      */
  +        final Object getKey()
  +        {
  +         return m_key;
  +     }
        /**
         * Returns the EnterpriseContext associated with this passivation job,
         * so the bean that will be passivated.
  
  
  

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

Reply via email to