djencks     2005/02/14 13:32:31

  Modified:    modules/core/src/java/org/openejb/sfsb
                        StatefulInstanceContext.java
                        StatefulSessionContext.java
  Log:

  implement the amazing rules on when getTimerService() and the TimerService 
and Timer methods are available
  
  Revision  Changes    Path
  1.9       +5 -1      
openejb/modules/core/src/java/org/openejb/sfsb/StatefulInstanceContext.java
  
  Index: StatefulInstanceContext.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/sfsb/StatefulInstanceContext.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- StatefulInstanceContext.java      5 Feb 2005 02:36:25 -0000       1.8
  +++ StatefulInstanceContext.java      14 Feb 2005 18:32:31 -0000      1.9
  @@ -89,6 +89,10 @@
           statefulContext.setState(operation);
       }
   
  +    public boolean setTimerState(EJBOperation operation) {
  +        return statefulContext.setTimerState(operation);
  +    }
  +
       public Object getId() {
           return id;
       }
  
  
  
  1.6       +19 -1     
openejb/modules/core/src/java/org/openejb/sfsb/StatefulSessionContext.java
  
  Index: StatefulSessionContext.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/sfsb/StatefulSessionContext.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- StatefulSessionContext.java       12 Oct 2004 20:01:13 -0000      1.5
  +++ StatefulSessionContext.java       14 Feb 2005 18:32:31 -0000      1.6
  @@ -60,6 +60,7 @@
   import org.openejb.EJBContextImpl;
   import org.openejb.EJBInstanceContext;
   import org.openejb.EJBOperation;
  +import org.openejb.timer.TimerState;
   import org.apache.geronimo.transaction.UserTransactionImpl;
   import org.apache.geronimo.transaction.context.TransactionContextManager;
   
  @@ -89,6 +90,13 @@
                   userTransaction.setOnline(false);
               }
           }
  +        
context.setTimerServiceAvailable(timerServiceAvailable[operation.getOrdinal()]);
  +    }
  +
  +    public boolean setTimerState(EJBOperation operation) {
  +        boolean oldTimerState = TimerState.getTimerState();
  +        
TimerState.setTimerState(timerMethodsAvailable[operation.getOrdinal()]);
  +        return oldTimerState;
       }
   
       public MessageContext getMessageContext() throws IllegalStateException {
  @@ -222,5 +230,15 @@
           states[EJBOperation.EJBREMOVE.getOrdinal()] = 
EJBCREATEREMOVEACTIVATE;
           states[EJBOperation.EJBACTIVATE.getOrdinal()] = 
EJBCREATEREMOVEACTIVATE;
           states[EJBOperation.BIZMETHOD.getOrdinal()] = BIZ_INTERFACE;
  +    }
  +
  +    private static final boolean timerServiceAvailable[] = new 
boolean[EJBOperation.MAX_ORDINAL];
  +    //timer service is never available in sfsb
  +
  +    private static final boolean timerMethodsAvailable[] = new 
boolean[EJBOperation.MAX_ORDINAL];
  +
  +    static {
  +        timerMethodsAvailable[EJBOperation.BIZMETHOD.getOrdinal()] = true;
  +        //TODO INCOMPLETE, for session synchronization allowed for 
afterBegin and beforeCompletion, disallowed afterCompletion.
       }
   }
  
  
  

Reply via email to