@Override
	public synchronized void removeEngine(Engine engine) {

        if( log.isDebugEnabled() )
            log.debug("Removing engine (" + engine.getInfo() + ")");

        // Is the specified Engine actually defined?
        int j = -1;
        for (int i = 0; i < engines.length; i++) {
            if (engine == engines[i]) {
                j = i;
                break;
            }
        }
        if (j < 0)
            return;

        // Remove any Connector that is using this Engine
        if( log.isDebugEnabled() )
            log.debug(" Removing related Containers");
        while (true) {
            int n = -1;
            Connector[] connectors = service.findConnectors();
            for (int i = 0; i < connectors.length; i++) {
                if (connectors[i].getService().getContainer() == (Container) engine) {
                    n = i;
                    break;
                }
            }
            if (n < 0)
                break;
            service.removeConnector(connectors[n]);
        }

        // Stop this Engine if necessary
        if (engine instanceof Lifecycle) {
            if( log.isDebugEnabled() )
                log.debug(" Stopping this Engine");
            try {
                ((Lifecycle) engine).stop();
            } catch (LifecycleException e) {
                log.error("Engine.stop", e);
            }
        }

        // Remove this Engine from our set of defined Engines
        if( log.isDebugEnabled() )
            log.debug(" Removing this Engine");
        int k = 0;
        Engine results[] = new Engine[engines.length - 1];
        for (int i = 0; i < engines.length; i++) {
            if (i != j)
                results[k++] = engines[i];
        }
        engines = results;

    }
@ Override public synchronized void removeEngine ( Engine engine ) { if ( log . isDebugEnabled ( ) ) log . debug ( "Removing engine (" + engine . getInfo ( ) + ")" ) ; int j = - 1 ; for ( int i = 0 ; i < engines . length ; i ++ ) { if ( engine == engines [ i ] ) { j = i ; break ; } } if ( j < 0 ) return ; if ( log . isDebugEnabled ( ) ) log . debug ( " Removing related Containers" ) ; while ( true ) { int n = - 1 ; Connector [ ] connectors = service . findConnectors ( ) ; for ( int i = 0 ; i < connectors . length ; i ++ ) { if ( connectors [ i ] . getService ( ) . getContainer ( ) == ( Container ) engine ) { n = i ; break ; } } if ( n < 0 ) break ; service . removeConnector ( connectors [ n ] ) ; } if ( engine instanceof Lifecycle ) { if ( log . isDebugEnabled ( ) ) log . debug ( " Stopping this Engine" ) ; try { ( ( Lifecycle ) engine ) . stop ( ) ; } catch ( LifecycleException e ) { log . error ( "Engine.stop" , e ) ; } } if ( log . isDebugEnabled ( ) ) log . debug ( " Removing this Engine" ) ; int k = 0 ; Engine results [ ] = new Engine [ engines . length - 1 ] ; for ( int i = 0 ; i < engines . length ; i ++ ) { if ( i != j ) results [ k ++ ] = engines [ i ] ; } engines = results ; }
/* (non-Javadoc)
@see org.jboss.arquillian.container.mobicents.servlet.sip.embedded_1.MobicentsSipServletsEmbedded#removeEngine(org.apache.catalina.Engine)