Example #1
0
  private static void timerCallbackHandler(int handlerNum, long currentTime, long scheduledTime) {
    TIMER_HANDLER_TYPE handler =
        (TIMER_HANDLER_TYPE) timerHashTable.get(Integer.toString(handlerNum));

    if (handler != null) {
      handler.handle(currentTime, scheduledTime);
    } else System.out.println("Ooops -- no handler for timer");
  }
Example #2
0
  public static int addTimer(long tdelay, long count, TIMER_HANDLER_TYPE handler) {
    int handlerNum = ++handlerNumber;
    String hashKey = Integer.toString(handlerNum);

    timerHashTable.put(handler.getClass().getName(), hashKey);
    timerHashTable.put(hashKey, handler);

    return IPC_addTimer(tdelay, count, handlerNum);
  }
Example #3
0
 public static int removeTimer(TIMER_HANDLER_TYPE handler) {
   return removeTimer(handler.getClass());
 }