djencks     2005/02/02 11:28:18

  Modified:    modules/core/src/java/org/openejb/entity/cmp
                        CMPRemoveMethod.java
  Log:

  GERONIMO-565. Removing an entity bean should cancel its timers
  
  Revision  Changes    Path
  1.7       +11 -1     
openejb/modules/core/src/java/org/openejb/entity/cmp/CMPRemoveMethod.java
  
  Index: CMPRemoveMethod.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/entity/cmp/CMPRemoveMethod.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- CMPRemoveMethod.java      2 Dec 2004 23:13:50 -0000       1.6
  +++ CMPRemoveMethod.java      2 Feb 2005 16:28:18 -0000       1.7
  @@ -55,6 +55,8 @@
   import java.util.Map;
   
   import javax.ejb.EJBLocalObject;
  +import javax.ejb.TimerService;
  +import javax.ejb.Timer;
   
   import org.apache.geronimo.core.service.InvocationResult;
   
  @@ -115,6 +117,14 @@
           InvocationResult result = invoke(invocation, EJBOperation.EJBREMOVE);
   
           if (result.isNormal()) {
  +            //cancel timers
  +            TimerService timerService = ctx.getTimerService();
  +            Collection timers = timerService.getTimers();
  +            for (Iterator iterator = timers.iterator(); iterator.hasNext();) 
{
  +                Timer timer = (Timer) iterator.next();
  +                timer.cancel();
  +            }
  +
               InTxCache cache = 
invocation.getTransactionContext().getInTxCache();
               CacheRow cacheRow = ctx.getCacheRow();
   
  
  
  

Reply via email to