code: public final boolean resumeWaiting(InternalEvent event)
          throws ActivityException {
          // check if timer is expired at this time?
          try {
              ActivityInstance ai = getEngine().getActivityInstance(getActivityInstanceId());
              Date expectedEndTime = ai.getEndDate();
              long currentTime = DatabaseAccess.getCurrentTime();
              if (currentTime>expectedEndTime.getTime()) {
                  int moreSeconds = processTimerExpiration();
                  if (moreSeconds>0) sendDelayedResumeMessage(moreSeconds);
                  else return true;
              }
          } catch (Exception e) {
              throw new ActivityException(-1, e.getMessage(), e);
          }
  
          EventWaitInstance received = registerWaitEvents(true,true);
          if (received!=null) {
               this.setReturnCode(received.getCompletionCode());
               processOtherMessage(getExternalEventInstanceDetails(received.getMessageDocumentId()));
               handleEventCompletionCode();
               return true;
           } else {
               return false;
           }
      }
docs: This method is made final for the class, as it contains internal logic handling resumption
  of waiting. It re-register the event waits including waiting for task to complete.
  If any event has already arrived, it processes it immediately.
  
  Customization should be done with the methods {@link #processOtherMessage(String, String)},
  {@link #registerWaitEvents()}, and {@link #processTimerExpiration()}.