});
LOG.debug("role {} starts with a configured prefix {}", role, prefix);
ClusterActionHandlerFactory factory = factoryMap.get(prefix);
checkArgument(factory != null, "could not create action handler factory %s", prefix);
String subrole = role.substring(prefix.length());
ClusterActionHandler returnVal = factory.create(subrole);
checkArgument(returnVal != null, "action handler factory %s could not create action handler for role %s",
prefix, subrole);
return returnVal;
} catch (NoSuchElementException e) {
LOG.debug("role {} didn't start with any of the configured prefixes {}", role, prefixes);
ClusterActionHandler returnVal = handlerMap.get(role);
checkArgument(returnVal != null, "Action handler not found for role: %s; configured roles %s", role,
handlerMap.keySet());
return returnVal;
}