User: fleury  
  Date: 00/10/17 16:45:49

  Modified:    src/main/org/jboss/ejb/plugins
                        EntityInstanceInterceptor.java
  Log:
  We only return a context to the cache if there is no transaction associated with it, 
if there is the tx sync will take care of returning the context to the pools
  
  Revision  Changes    Path
  1.19      +27 -24    
jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java
  
  Index: EntityInstanceInterceptor.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- EntityInstanceInterceptor.java    2000/10/17 21:59:43     1.18
  +++ EntityInstanceInterceptor.java    2000/10/17 23:45:49     1.19
  @@ -43,7 +43,7 @@
   *   @see <related>
   *   @author Rickard �berg ([EMAIL PROTECTED])
   *   @author <a href="[EMAIL PROTECTED]">Marc Fleury</a>
  -*   @version $Revision: 1.18 $
  +*   @version $Revision: 1.19 $
   */
   public class EntityInstanceInterceptor
   extends AbstractInterceptor
  @@ -215,29 +215,32 @@
          } finally
          {
            //         Logger.debug("Release instance for "+id);
  -         if (ctx != null)
  -         {
  -          
  -          synchronized (mutex) {
  -              
  -              // unlock the context
  -              ctx.unlock();
  -              
  -              if (ctx.getId() == null)                             
  -              {
  -                 // Remove from cache
  -                 cache.remove(key);
  -                 
  -                 // It has been removed -> send to free pool
  -                 container.getInstancePool().free(ctx);
  -              }
  -              
  -              // notify the thread waiting on ctx
  -                       synchronized (ctx) {
  -                             ctx.notifyAll();
  -                       }
  -          }
  -         }
  +                     if (ctx != null)
  +                     {
  +                             
  +                             synchronized (mutex) {
  +                                     
  +                                     // unlock the context
  +                                     ctx.unlock();
  +                                     
  +                                     if (ctx.getId() == null)                       
      
  +                                     {
  +                                             
  +                                             // Work only if no transaction was 
encapsulating this remove()
  +                                             if (ctx.getTransaction() == null) {
  +                                                     
  +                                                     // Remove from cache
  +                                                     cache.remove(key);
  +                                                     
  +                                                     // It has been removed -> send 
to the pool
  +                                                     
container.getInstancePool().free(ctx);
  +                                             }
  +                                     }
  +                                     
  +                                     // notify the thread waiting on ctx
  +                                     synchronized (ctx) { ctx.notifyAll();}
  +                             }
  +                     }
          }
       }
       
  
  
  

Reply via email to