You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by Vladimir Bossicard <vl...@adnovum.com> on 2002/07/11 02:33:14 UTC

Stopping the Kernel

Hi all,

I have a trivial class that starts and stops the kernel but the
application never exits.

public class testXindice {
    public void go() {
        Kernel kernel = new
Kernel("/home/Apache/xml-xindice-1.0/config/system.xml");
        kernel.shutDown(1, false);
    }
    public static void main(String[] args) {
        (new testXindice()).go();
    }
}

and the execution looks pretty normal:

Database: 'db' initializing
Script: 'GET' added to script storage
Service: 'db' started
Service: 'HTTPServer' started @ http://delta.adnovum.com:4080/
Service: 'APIService' started

Server Running

Service: 'APIService' stopped
Service: 'HTTPServer' stopped
Service: 'db' stopped
Server shutdown (Exit code 1)

but the JVM is running, running, still running...

Any idea?

-Vladimir

-- 
+---------------------------------------------------------------------+
 Vladimir Bossicard              mailto:vladimir.bossicard@adnovum.com 
 Software Engineer                             MS Computer Science ETH

 AdNovum Software Inc. San Mateo, CA 94404    phone: +1 (650) 525 9322 
 1400 Fashion Island Boulevard, Suite 309     fax:   +1 (650) 525 9324 
+---------------------------------------------------------------------+
 AdNovum Informatik AG http://www.adnovum.ch  phone: +41 (1)  272 6111 
 Roentgenstrasse 22, CH-8005 Zuerich          fax:   +41 (1)  272 6312 
+---------------------------------------------------------------------+

Re: Stopping the Kernel

Posted by Vladimir Bossicard <vl...@adnovum.com>.
Mark,

> As long as any threads are running, the JVM won't exit.

I totally agree with you but I would expect that after calling the
Kernel's shutDown method, the Kernel instance actually cleans "it's
mess" and quickly stops the theads it has started.

> > Service: 'APIService' stopped
> > Service: 'HTTPServer' stopped
> > Service: 'db' stopped
> > Server shutdown (Exit code 1)

if every service has been successfully stopped, why are some threads
still running?  If an object is creating a thread, it should be able to
stop it and not let it "float around" without control.  For a normal
server, killing the VM is an option (you don't have to provide a
shutdown method and only users with "physical" access to the machine can
shutdown the server) but it's certainly a problem once you want to embed
your server into another application.

I haven't had the time to dive into the code too deeply and I don't
blame anyone but for me it's clearly the sign that there's some flaws in
the code.  I hope I'll be able to give more precise detail and valuable
feedback soon.

-Vladimir

-- 
+---------------------------------------------------------------------+
 Vladimir Bossicard              mailto:vladimir.bossicard@adnovum.com 
 Software Engineer                             MS Computer Science ETH

 AdNovum Software Inc. San Mateo, CA 94404    phone: +1 (650) 525 9322 
 1400 Fashion Island Boulevard, Suite 309     fax:   +1 (650) 525 9324 
+---------------------------------------------------------------------+
 AdNovum Informatik AG http://www.adnovum.ch  phone: +41 (1)  272 6111 
 Roentgenstrasse 22, CH-8005 Zuerich          fax:   +41 (1)  272 6312 
+---------------------------------------------------------------------+

Re: Stopping the Kernel

Posted by "Mark J. Stang" <ma...@earthlink.net>.
Vladimir,
As long as any threads are running, the JVM won't exit.

HTH,

Mark

Vladimir Bossicard wrote:

> Hi all,
>
> I have a trivial class that starts and stops the kernel but the
> application never exits.
>
> public class testXindice {
>     public void go() {
>         Kernel kernel = new
> Kernel("/home/Apache/xml-xindice-1.0/config/system.xml");
>         kernel.shutDown(1, false);
>     }
>     public static void main(String[] args) {
>         (new testXindice()).go();
>     }
> }
>
> and the execution looks pretty normal:
>
> Database: 'db' initializing
> Script: 'GET' added to script storage
> Service: 'db' started
> Service: 'HTTPServer' started @ http://delta.adnovum.com:4080/
> Service: 'APIService' started
>
> Server Running
>
> Service: 'APIService' stopped
> Service: 'HTTPServer' stopped
> Service: 'db' stopped
> Server shutdown (Exit code 1)
>
> but the JVM is running, running, still running...
>
> Any idea?
>
> -Vladimir
>
> --
> +---------------------------------------------------------------------+
>  Vladimir Bossicard              mailto:vladimir.bossicard@adnovum.com
>  Software Engineer                             MS Computer Science ETH
>
>  AdNovum Software Inc. San Mateo, CA 94404    phone: +1 (650) 525 9322
>  1400 Fashion Island Boulevard, Suite 309     fax:   +1 (650) 525 9324
> +---------------------------------------------------------------------+
>  AdNovum Informatik AG http://www.adnovum.ch  phone: +41 (1)  272 6111
>  Roentgenstrasse 22, CH-8005 Zuerich          fax:   +41 (1)  272 6312
> +---------------------------------------------------------------------+

--
Mark J Stang
System Architect
Cybershop Systems