Thanks Yu! Got it.
> 在 2016年12月21日,下午11:19,Ted Yu <[email protected]> 写道:
>
> From NamespacesInstanceResource :
>
> private boolean doesNamespaceExist(Admin admin, String namespaceName)
> throws IOException{
> NamespaceDescriptor[] nd = admin.listNamespaceDescriptors();
> for(int i = 0; i < nd.length; i++){
> if(nd[i].getName().equals(namespaceName)){
> return true;
> }
> }
> return false;
> }
>
> You can use the above code without triggering exception.
>
> FYI
>
> On Wed, Dec 21, 2016 at 7:15 AM, 小展 <[email protected]> wrote:
>
>> Hi, guys
>> In Admin class , we still haven’t a api to check the namespace
>> exist . Now , when I want to check a namespace exist in my cluster , I
>> use #getNamespaceDescriptor。 If catch NamespaceNotFoundException than
>> return false,otherwise return true . I don’t think that’s a good way . And
>> I also find in TableNamespceManager class we used
>> doesNamespaceExist(final String namespaceName) to check namespace exist .
>>
>> I don’t know is there I miss something .
>>
>> If you have better way Or we should add a api ? Please tell me .