/** * @param id * @return */ public String getListenersAsHtmlFragment(I id) { String ret = ""; C ci = commInfo.get(id); MessageListener<Mi, M> lastListenerForCom = ci.getLastListener(); if (ci != null) { boolean first = true; for (MessageListener<Mi, M> lst : ci.getListeners()) { if (!first) ret += "<br>"; else first = false; ret += lst.getClass().getName() + " [" + Integer.toHexString(lst.hashCode()) + "]"; // ret += lst.getClass().getSimpleName() + " [" + Integer.toHexString(lst.hashCode()) + "]"; if (useListenersQueues) { try { ret += " {" + ci.getListenersQueueProvider().get(lst).getMessageCount() + " msgs}"; } catch (Exception e) { NeptusLog.pub().warn(this.getClass().getSimpleName(), e); } } if (lastListenerForCom == lst) { ret += " working"; } } } return ret; }
/** * Removes this listener from all systems excluding the common. * * @param listener * @return */ public final boolean removeListenerFromAllSystems(MessageListener<Mi, M> listener) { boolean ret = false; int r = 0; for (C vci : commInfo.values()) { boolean rt = vci.removeListener( listener); // This HAS TO be separated from the line of code bellow because // it might not run if "ret" is already true ret = ret || rt; if (rt) r++; } NeptusLog.pub() .debug( "Removed " + listener.getClass().getName() + " | " + r + " | " + listener.hashCode()); return ret; }
/** @return */ public String getListenersAsHtmlFragment() { String ret = ""; boolean first = true; for (MessageListener<Mi, M> lst : getListeners()) { if (!first) ret += "<br>"; else first = false; ret += lst.getClass().getName() + " [" + Integer.toHexString(lst.hashCode()) + "]"; // ret += lst.getClass().getSimpleName() + " [" + Integer.toHexString(lst.hashCode()) + "]"; if (useListenersQueues) { try { ret += " {" + getListenersQueueProvider().get(lst).getMessageCount() + " msgs}"; } catch (Exception e) { e.printStackTrace(); } } if (lastListener == lst) { ret += " working"; } } return ret; }