code: private void checkIfCancelled()
      {
          // If a cancel has been committed then the timer "does not exist",
          // unless the cancel occurred after the timer started running
          // and the current thread is for that running timeout method.
          if (ivDestroyed && ivTimeoutThread != Thread.currentThread()) {
              String msg = "Timer with ID " + ivTaskId + " has been canceled.";
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                  Tr.debug(tc, "checkIfCancelled: NoSuchObjectLocalException : " + msg);
              throw new NoSuchObjectLocalException(msg);
          }
  
          // If cancel was called during the current transaction then the timer
          // "does not exist", regardless of whether or not the current thread
          // is a running timeout method.
          ContainerTx tx = ivContainer.getCurrentContainerTx();
          if (tx != null && tx.timersCanceled != null && tx.timersCanceled.containsValue(this)) {
              String msg = "Timer with ID " + ivTaskId + " has been canceled in the current transaction.";
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                  Tr.debug(tc, "checkIfCancelled: NoSuchObjectLocalException : " + msg);
              throw new NoSuchObjectLocalException(msg);
          }
      }
docs: Determines if Timer methods are allowed based on the 'cancelled' state
  of the timer instance relative to the current thread and transaction.
  NoSuchObjectLocalException is thrown if the timer has been cancelled. <p>
  
  Returns true if the current thread is running in the scope of the timeout
  method, and access is allowed to Timer state even if another thread has
  cancelled the timer; otherwise returns false.
  
  Note that if the current thread is running in the scope of the timeout
  method, it should have access to timer state even if another thread
  cancels the timer. However, if the timeout method calls cancel, then
  that access is no longer allowed. The EJB specification does indicate
  that calling Timer methods should fail after calling cancel, and not
  specifically commit of the cancel transaction.
  
  This is similar to the caching support provided for persistent timers.
  
  Must be called by all Timer methods to insure EJB Specification
  compliance. <p>
  
  @throws NoSuchObjectLocalException if this instance has been cancelled
  relative to the current thread and transaction.