NodeTabCountResponse(byte[] addr, int num, int type, byte... data) throws ProtocolException { super(addr, num, type, data); if (data == null || data.length < 1) { throw new ProtocolException("No valid MSG_NODETAB_COUNT received."); } LOGGER.debug("Number of nodes in system: {}", getCount()); }
/** * Get the number of nodes from the system. * * @return the number of nodes * @throws ProtocolException */ public Integer getNodeCount() throws ProtocolException { LOGGER.debug("Get all registered nodes from system."); BidibMessage response = send(requestFactory.createNodeTabGetAll(), null, true, NodeTabCountResponse.TYPE); if (response instanceof NodeTabCountResponse) { int totalNodes = ((NodeTabCountResponse) response).getCount(); LOGGER.debug("Found total nodes: {}", totalNodes); return totalNodes; } if (ignoreWaitTimeout) { LOGGER.warn("No response received but ignoreWaitTimeout ist set! Current node: {}", this); return Integer.valueOf(0); } throw createNoResponseAvailable("get node count"); }