public static String printPingData(List<PingData> rsps) { StringBuilder sb=new StringBuilder(); if(rsps != null) { int total=rsps.size(); int servers=0, clients=0, coords=0; for(PingData rsp : rsps) { if(rsp.isCoord()) coords++; if(rsp.isServer()) servers++; else clients++; } sb.append(total + " total (" + servers + " servers (" + coords + " coord), " + clients + " clients)"); } return sb.toString(); }
public String toString() { StringBuilder sb=new StringBuilder(); sb.append(sender); if(logical_name != null) sb.append(", name=").append(logical_name); if(physical_addr != null) sb.append(", addr=").append(physical_addr); if(isCoord()) sb.append(", coord"); else if(isServer()) sb.append(", server"); if(mbrs != null) sb.append(", mbrs=" + mbrs.size()); return sb.toString(); }
/** * Creates a byte[] representation of the PingData, but DISCARDING the view it contains. * @param data the PingData instance to serialize. * @return */ protected byte[] serializeWithoutView(PingData data) { final PingData clone = new PingData(data.getAddress(), data.isServer(), data.getLogicalName(), data.getPhysicalAddr()).coord(data.isCoord()); try { return Util.streamableToByteBuffer(clone); } catch(Exception e) { log.error(Util.getMessage("ErrorSerializingPingData"), e); return null; } }
public String toString() { StringBuilder sb=new StringBuilder(); sb.append(sender); if(logical_name != null) sb.append(", name=").append(logical_name); if(physical_addr != null) sb.append(", addr=").append(physical_addr); if(isCoord()) sb.append(", coord"); else if(isServer()) sb.append(", server"); if(mbrs != null) sb.append(", mbrs=" + mbrs.size()); return sb.toString(); }
public static String printPingData(List<PingData> rsps) { StringBuilder sb=new StringBuilder(); if(rsps != null) { int total=rsps.size(); int servers=0, clients=0, coords=0; for(PingData rsp : rsps) { if(rsp.isCoord()) coords++; if(rsp.isServer()) servers++; else clients++; } sb.append(total + " total (" + servers + " servers (" + coords + " coord), " + clients + " clients)"); } return sb.toString(); }
/** * Creates a byte[] representation of the PingData, but DISCARDING the view it contains. * @param data the PingData instance to serialize. * @return */ protected byte[] serializeWithoutView(PingData data) { final PingData clone = new PingData(data.getAddress(), data.isServer(), data.getLogicalName(), data.getPhysicalAddr()).coord(data.isCoord()); try { return Util.streamableToByteBuffer(clone); } catch(Exception e) { log.error(Util.getMessage("ErrorSerializingPingData"), e); return null; } }