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)); }
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; } }
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); }
private static Object unmarshallMsgData(int formatter, int byteArray, Class msgDataClass) throws Exception { Object object = null; // Throw an exception if class does not match formatter formatters.checkDataClass(formatter, msgDataClass); if (msgDataClass.isArray()) { // Create a top-level fixed-length array, based on the formatter. object = formatters.createFixedArray(msgDataClass.getComponentType(), formatter); } else { // Create an object type that Java IPC can handle object = coerceDataClass(msgDataClass).newInstance(); } formatters.unmarshall(formatter, byteArray, object); IPC_freeByteArray(byteArray); if (formatters.IPCPrim.class.isAssignableFrom(object.getClass())) { object = ((formatters.IPCPrim) object).coerce(); } return object; }
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; } }