use of org.apache.geode.management.internal.cli.functions.DescribeDiskStoreFunction in project geode by apache.
the class DiskStoreCommands method getDiskStoreDescription.
protected DiskStoreDetails getDiskStoreDescription(final String memberName, final String diskStoreName) {
// may throw a
final DistributedMember member = getMember(getCache(), memberName);
// MemberNotFoundException
final ResultCollector<?, ?> resultCollector = getMembersFunctionExecutor(Collections.singleton(member)).setArguments(diskStoreName).execute(new DescribeDiskStoreFunction());
final Object result = ((List<?>) resultCollector.getResult()).get(0);
if (result instanceof DiskStoreDetails) {
// disk store details in hand...
return (DiskStoreDetails) result;
} else if (result instanceof DiskStoreNotFoundException) {
// bad disk store name...
throw (DiskStoreNotFoundException) result;
} else {
// unknown and unexpected return type...
final Throwable cause = (result instanceof Throwable ? (Throwable) result : null);
if (isLogging()) {
if (cause != null) {
getGfsh().logSevere(String.format("Exception (%1$s) occurred while executing '%2$s' on member (%3$s) with disk store (%4$s).", ClassUtils.getClassName(cause), CliStrings.DESCRIBE_DISK_STORE, memberName, diskStoreName), cause);
} else {
getGfsh().logSevere(String.format("Received an unexpected result of type (%1$s) while executing '%2$s' on member (%3$s) with disk store (%4$s).", ClassUtils.getClassName(result), CliStrings.DESCRIBE_DISK_STORE, memberName, diskStoreName), null);
}
}
throw new RuntimeException(CliStrings.format(CliStrings.UNEXPECTED_RETURN_TYPE_EXECUTING_COMMAND_ERROR_MESSAGE, ClassUtils.getClassName(result), CliStrings.DESCRIBE_DISK_STORE), cause);
}
}
Aggregations