use of com.ms.silverking.cloud.dht.client.RetrievalException in project SilverKing by Morgan-Stanley.
the class NamespaceMetaStore method getNamespaceProperties.
// FUTURE - THINK ABOUT COMPLETELY REMOVING ANY READS/WRITES TO META NS FROM THE SERVER SIDE
// clients can probably do it all
public NamespaceProperties getNamespaceProperties(long namespace, NamespaceOptionsRetrievalMode retrievalMode) {
try {
NamespaceProperties nsProperties;
nsProperties = nsPropertiesMap.get(namespace);
if (nsProperties != null) {
return nsProperties;
} else {
switch(retrievalMode) {
case LocalCheckOnly:
return null;
case FetchRemotely:
nsProperties = nsOptionsClient.getNamespaceProperties(namespace, nsOptionsFetchTimeoutMillis);
if (nsProperties != null) {
nsPropertiesMap.put(namespace, nsProperties);
return nsProperties;
} else {
Log.warning(String.format("Namespace not found %x", namespace));
Log.warning(getNamespaceMetaDataReplicas(namespace));
throw new NamespaceNotCreatedException(Long.toHexString(namespace));
}
default:
throw new RuntimeException("Panic");
}
}
} catch (TimeoutException te) {
Log.warning("Failed to retrieve namespace due to timeout " + String.format("%x", namespace));
Log.warning(getNamespaceMetaDataReplicas(namespace));
throw new NamespaceNotCreatedException(Long.toHexString(namespace), te);
} catch (RetrievalException re) {
Log.warning("Failed to retrieve namespace " + String.format("%x", namespace));
Log.warning(getNamespaceMetaDataReplicas(namespace));
Log.warning(re.getDetailedFailureMessage());
throw new NamespaceNotCreatedException(Long.toHexString(namespace), re);
}
}
Aggregations