Ejemplo n.º 1
0
  public static int removeTimer(Class handlerClass) {
    String hashKey = handlerClass.getName();
    String handlerNum = (String) timerHashTable.get(hashKey);

    timerHashTable.remove(hashKey);
    timerHashTable.remove(handlerNum);

    return IPC_removeTimer(Integer.parseInt(handlerNum));
  }
Ejemplo n.º 2
0
 public static int unsubscribeConnect(Class connectHandlerClass) {
   if (!removeFromHandlerList(connectHandlers, connectHandlerClass)) {
     System.out.println("No connection handler found of class " + connectHandlerClass.getName());
     return IPC_Error;
   } else if (connectHandlers.size() == 0) {
     return IPC_unsubscribeConnect();
   } else {
     return IPC_OK;
   }
 }
Ejemplo n.º 3
0
  public static int unsubscribe(String msgName, Class msgHandlerClass) {
    /* Do it this way because multiple handlers can be subscribed for the
    same message */
    String handlerName = msgName + msgHandlerClass.getName();
    String hashKey = (String) msgHashTable.get(handlerName);

    msgHashTable.remove(handlerName);
    msgHashTable.remove(hashKey);

    return IPC_unsubscribe(msgName, handlerName);
  }
Ejemplo n.º 4
0
 public static int unsubscribeHandlerChange(String msgName, Class handlerChangeHandlerClass) {
   List handlerList = (List) handlerChangeHashTable.get(msgName);
   if (handlerList == null) {
     return IPC_Error;
   } else if (!removeFromHandlerList(handlerList, handlerChangeHandlerClass)) {
     System.out.println(
         "No change handler found for message "
             + msgName
             + " of class "
             + handlerChangeHandlerClass.getName());
     return IPC_Error;
   } else if (handlerList.size() == 0) {
     return IPC_unsubscribeHandlerChange(msgName);
   } else {
     return IPC_OK;
   }
 }