/** * Formats an IP address by adding padding to the left. * * @param ipAddress the IP address * @return the formatted IP address */ public static String formatIpAddress(String ipAddress) { return padLeft(ipAddress, IP_ADDRESS_LENGTH); }
/** * Formats an IP address by adding padding to the left. * * @param ipAddress the IP address * @return the formatted IP address */ public static String formatIpAddress(String ipAddress) { return padLeft(ipAddress, IP_ADDRESS_LENGTH); }
/** * Formats a long number and adds padding to the left. * * Very inefficient implementation, but a lot easier than to deal with the formatting API. * * @param number number to format * @param length width of padding * @return formatted number */ public static String formatLong(long number, int length) { return padLeft(format(Locale.US, "%,d", number), length); }
/** * Formats a long number and adds padding to the left. * * Very inefficient implementation, but a lot easier than to deal with the formatting API. * * @param number number to format * @param length width of padding * @return formatted number */ public static String formatLong(long number, int length) { return padLeft(format(Locale.US, "%,d", number), length); }
/** * Formats a double number and adds padding to the left. * * Very inefficient implementation, but a lot easier than to deal with the formatting API. * * @param number number to format * @param length width of padding * @return formatted number */ public static String formatDouble(double number, int length) { return padLeft(format(Locale.US, "%,.2f", number), length); }
/** * Formats a double number and adds padding to the left. * * Very inefficient implementation, but a lot easier than to deal with the formatting API. * * @param number number to format * @param length width of padding * @return formatted number */ public static String formatDouble(double number, int length) { return padLeft(format(Locale.US, "%,.2f", number), length); }
private void printLayout() { LOGGER.info(HORIZONTAL_RULER); LOGGER.info("Cluster layout"); LOGGER.info(HORIZONTAL_RULER); for (AgentWorkerLayout agentWorkerLayout : agentWorkerLayouts) { Set<String> agentVersionSpecs = agentWorkerLayout.getVersionSpecs(); int agentMemberWorkerCount = agentWorkerLayout.count(WorkerType.MEMBER); int agentClientWorkerCount = agentWorkerLayout.workerProcessSettingsList.size() - agentMemberWorkerCount; int totalWorkerCount = agentMemberWorkerCount + agentClientWorkerCount; String message = " Agent %s (%s) members: %s, clients: %s"; if (totalWorkerCount > 0) { message += ", mode: %s, version specs: %s"; } else { message += " (no workers)"; } LOGGER.info(format(message, agentWorkerLayout.agentData.formatIpAddresses(), agentWorkerLayout.agentData.getAddress(), formatLong(agentMemberWorkerCount, 2), formatLong(agentClientWorkerCount, 2), padLeft(agentWorkerLayout.agentData.getAgentWorkerMode().toString(), WORKER_MODE_LENGTH), agentVersionSpecs )); } }