public NameNodeHandler resolve(RequestMetaInfo metaInfo) throws NameNodeRoutingException {
final int clusterId = metaInfo.getClusterId();
if (clusterId == RequestMetaInfo.NO_CLUSTER_ID) {
String msg = "ClusterId not specified";
LOG.error(msg);
throw new NameNodeRoutingException(msg);
}
if (clusterId != this.clusterId) {
String msg = "ClusterId: " + clusterId + " does NOT match " + "expected: " + this.clusterId;
LOG.error(msg);
throw new NameNodeRoutingException(msg);
}
final String resourceId = metaInfo.getResourceId();
NameNodeHandler handler = handlers.get(resourceId);
if (handler == null) {
throw new NameNodeRoutingException("Not recognized resourceId: " + resourceId);
}
return handler;
}