public synchronized void remove(String name) throws IOException {
if (get(name) == null) {
throw new NamespaceNotFoundException(name);
}
if (NamespaceDescriptor.RESERVED_NAMESPACES.contains(name)) {
throw new ConstraintException("Reserved namespace "+name+" cannot be removed.");
}
int tableCount;
try {
tableCount = masterServices.listTableDescriptorsByNamespace(name).size();
} catch (FileNotFoundException fnfe) {
throw new NamespaceNotFoundException(name);
}
if (tableCount > 0) {
throw new ConstraintException("Only empty namespaces can be removed. " +
"Namespace "+name+" has "+tableCount+" tables");
}
Delete d = new Delete(Bytes.toBytes(name));
getNamespaceTable().delete(d);
//don't abort if cleanup isn't complete