public void destroySubcontext ( Name name ) throws NamingException { if ( _nc == null ) throw IIOPLogger . ROOT_LOGGER . notANamingContext ( name . toString ( ) ) ; NamingContext the_nc = _nc ; NameComponent [ ] path = org . wildfly . iiop . openjdk . naming . jndi . CNNameParser . nameToCosName ( name ) ; if ( name . size ( ) > 0 ) { try { javax . naming . Context ctx = ( javax . naming . Context ) callResolve ( path ) ; CNCtx cnc = ( CNCtx ) ctx ; the_nc = cnc . _nc ; cnc . close ( ) ; //remove the reference to the context } catch ( ClassCastException e ) { throw new NotContextException ( name . toString ( ) ) ; } catch ( CannotProceedException e ) { javax . naming . Context cctx = getContinuationContext ( e ) ; cctx . destroySubcontext ( e . getRemainingName ( ) ) ; return ; } catch ( NameNotFoundException e ) { // If leaf is the one missing, return success // as per JNDI spec if ( e . getRootCause ( ) instanceof NotFound && leafNotFound ( ( NotFound ) e . getRootCause ( ) , path [ path . length - 1 ] ) ) { return ; // leaf missing OK } throw e ; } catch ( NamingException e ) { throw e ; } } callDestroy ( the_nc ) ; callUnbind ( path ) ; }
Uses the callDestroy function to destroy the context . Destroys the current context if name is empty .