use of io.aeron.cluster.service.ClusterMarkFile in project Aeron by real-logic.
the class ClusterTool method errors.
/**
* Print out the errors in the error logs for the cluster components.
*
* @param out to print the output to.
* @param clusterDir where the cluster is running.
*/
public static void errors(final PrintStream out, final File clusterDir) {
if (markFileExists(clusterDir) || TIMEOUT_MS > 0) {
try (ClusterMarkFile markFile = openMarkFile(clusterDir, System.out::println)) {
printTypeAndActivityTimestamp(out, markFile);
printErrors(out, markFile);
final String aeronDirectory = markFile.decoder().aeronDirectory();
out.println();
printDriverErrors(out, aeronDirectory);
}
} else {
out.println(ClusterMarkFile.FILENAME + " does not exist.");
}
final ClusterMarkFile[] serviceMarkFiles = openServiceMarkFiles(clusterDir, out::println);
errors(out, serviceMarkFiles);
}
use of io.aeron.cluster.service.ClusterMarkFile in project Aeron by real-logic.
the class ClusterTool method openServiceMarkFiles.
private static ClusterMarkFile[] openServiceMarkFiles(final File clusterDir, final Consumer<String> logger) {
String[] clusterMarkFileNames = clusterDir.list((dir, name) -> name.startsWith(ClusterMarkFile.SERVICE_FILENAME_PREFIX) && name.endsWith(ClusterMarkFile.FILE_EXTENSION));
if (null == clusterMarkFileNames) {
clusterMarkFileNames = ArrayUtil.EMPTY_STRING_ARRAY;
}
final ClusterMarkFile[] clusterMarkFiles = new ClusterMarkFile[clusterMarkFileNames.length];
for (int i = 0, length = clusterMarkFiles.length; i < length; i++) {
clusterMarkFiles[i] = new ClusterMarkFile(clusterDir, clusterMarkFileNames[i], System::currentTimeMillis, TIMEOUT_MS, logger);
}
return clusterMarkFiles;
}
use of io.aeron.cluster.service.ClusterMarkFile in project Aeron by real-logic.
the class ClusterTool method listMembers.
/**
* Print out a list of the current members of the cluster.
*
* @param out to print the output to.
* @param clusterDir where the cluster is running.
*/
public static void listMembers(final PrintStream out, final File clusterDir) {
if (markFileExists(clusterDir) || TIMEOUT_MS > 0) {
try (ClusterMarkFile markFile = openMarkFile(clusterDir, System.out::println)) {
final ClusterMembership clusterMembership = new ClusterMembership();
final long timeoutMs = Math.max(TimeUnit.SECONDS.toMillis(1), TIMEOUT_MS);
if (queryClusterMembers(markFile, timeoutMs, clusterMembership)) {
out.println("currentTimeNs=" + clusterMembership.currentTimeNs + ", leaderMemberId=" + clusterMembership.leaderMemberId + ", memberId=" + clusterMembership.memberId + ", activeMembers=" + clusterMembership.activeMembers + ", passiveMembers=" + clusterMembership.passiveMembers);
} else {
out.println("timeout waiting for response from node");
}
}
} else {
out.println(ClusterMarkFile.FILENAME + " does not exist.");
}
}
use of io.aeron.cluster.service.ClusterMarkFile in project Aeron by real-logic.
the class ClusterTool method describe.
/**
* Print out the descriptors in the {@link ClusterMarkFile}s.
*
* @param out to print the output to.
* @param serviceMarkFiles to query.
*/
public static void describe(final PrintStream out, final ClusterMarkFile[] serviceMarkFiles) {
for (final ClusterMarkFile serviceMarkFile : serviceMarkFiles) {
printTypeAndActivityTimestamp(out, serviceMarkFile);
out.println(serviceMarkFile.decoder());
serviceMarkFile.close();
}
}
use of io.aeron.cluster.service.ClusterMarkFile in project Aeron by real-logic.
the class ClusterTool method describe.
/**
* Print out the descriptors in the {@link ClusterMarkFile}s.
*
* @param out to print the output to.
* @param clusterDir where the cluster is running.
*/
public static void describe(final PrintStream out, final File clusterDir) {
if (markFileExists(clusterDir) || TIMEOUT_MS > 0) {
try (ClusterMarkFile markFile = openMarkFile(clusterDir, out::println)) {
printTypeAndActivityTimestamp(out, markFile);
out.println(markFile.decoder());
}
} else {
out.println(ClusterMarkFile.FILENAME + " does not exist.");
}
final ClusterMarkFile[] serviceMarkFiles = openServiceMarkFiles(clusterDir, out::println);
describe(out, serviceMarkFiles);
}
Aggregations