code: @Override
      @Trivial
      public void cancel() throws IllegalStateException, NoSuchObjectLocalException, EJBException {
          final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
          if (isTraceOn && tc.isEntryEnabled())
              Tr.entry(tc, "cancel: " + this);
  
          boolean removed;
  
          // Determine if the calling bean is in a state that allows timer service
          // method access - throws IllegalStateException if not allowed.
          checkTimerAccess();
  
          try {
              removed = persistentTimerRuntime.remove(taskId);
          } catch (Throwable ex) {
              throw newTimerServiceException(ex);
          }
  
          if (!removed) {
              throw newNoSuchObjectLocalException();
          }
  
          if (isTraceOn && tc.isEntryEnabled())
              Tr.exit(tc, "cancel: successful");
      }
docs: Cause the timer and all its associated expiration notifications
  to be cancelled. <p>
  
  @throws IllegalStateException If this method is invoked while the
  instance is in a state that does not allow access to this method.
  @throws NoSuchObjectLocalException If invoked on a timer that has
  expired or has been cancelled.
  @throws EJBException If this method could not complete due to a
  system-level failure.