Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Shutdown
Shutdown [message #100299] Thu, 25 October 2007 05:48 Go to next message
Eclipse UserFriend
Originally posted by: codex.magic-dreams.de

Hello,

I have an application (Eclipse 3.3, implementing the IApplication
interface). I run the application by specifying it in the config.ini.
noShutdown and noExit are set to false. When I start osgi, the
application is started, executes and exits. Unfortunately the framework
is not stop. When I examine the active apps, my application is stopped.
How can I trigger a complete shutdown from my application? I tried
several methods:
- System.exit works but I suppose this is not a clean an preferred way
- EclipseStarter.shutdown also works, but I don't use it for starting so
why should I use it for shutdown. Does that work? I also get a
discouraged access warning for EclipseStarter.

What is the correct way to do something like that?

Thanks
Wolfgang
Re: Shutdown [message #100438 is a reply to message #100299] Fri, 26 October 2007 21:50 Go to previous messageGo to next message
Thomas Watson is currently offline Thomas WatsonFriend
Messages: 503
Registered: July 2009
Senior Member
Are you running a console (using -console)? If so is it still running
and functional? My guess is that there are still some non-daemon
threads running in the VM. If the console is still functional you can
run the "threads" command to see the list of running threads. Check to
see if there are non-daemon threads running. Also run the ss command
and check the status of the bundles. The should all be in the INSTALLED
state.

When you launch with the native launcher (eclipse.exe) or with the
launcher jar (org.eclipse.equinox.launcher.jar) then a separate Main
class is used to actually launch the framework. This class waits for
the application to return and then will call System.exit once it has
control back. See org.eclipse.equinox.launcher.Main class.

I'm guessing you are just launching with the org.eclipse.osgi.jar
directly? Tell us more about how you are launching the Framework.

Tom
Re: Shutdown [message #100454 is a reply to message #100438] Sat, 27 October 2007 21:46 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: codex.magic-dreams.de

I am launching with org.eclipse.osgi, that is right.

I have the following config.ini:
osgi.bundles=org.eclipse.equinox.common@2:start,
org.eclipse.update.configurator@3:start, org.eclipse.core.runtime@start
osgi.noShutdown=false
osgi.noExit=false
eclipse.application=EquinoxTest1.equinoxtest

The application looks like:
public class EquinoxTest1 implements IApplication {
public Object start(IApplicationContext context) {
System.out.println("EquinoxTest1");
return IApplication.EXIT_OK;
}
public void stop() {
}
}

Normally I don't run with a console, because I don't want the user to
notice there is osgi behind (at least at first glance).

When I run with console, the thread output is:

ThreadGroupType: Name: ParentGroup: MaxP: Threads:
ThreadGroup main system 10 5/5

ThreadType: Name: ThreadGroup: Prio:
Thread DestroyJavaVM main 5
Finalizer$Finalize Finalizer system 8 [daemon]
EventManager$Event Framework Event Dispa main 5 [daemon]
Thread OSGi Console main 5
Reference$Referenc Reference Handler system 10 [daemon]
Thread Signal Dispatcher system 9 [daemon]
EventManager$Event Start Level Event Dis main 5 [daemon]
Thread State Saver main 5

ss outputs:

Framework is launched.

id State Bundle
0 ACTIVE org.eclipse.osgi_3.3.0.v20070530
1 ACTIVE org.eclipse.equinox.common_3.3.0.v20070426
2 ACTIVE org.eclipse.update.configurator_3.2.100.v20070
3 ACTIVE org.eclipse.core.runtime_3.3.100.v20070530
4 RESOLVED EquinoxTest1_1.0.0
5 <<LAZY>> org.eclipse.core.contenttype_3.2.100.v20070319
6 ACTIVE org.eclipse.core.jobs_3.3.0.v20070423
7 ACTIVE org.eclipse.equinox.app_1.0.0.v20070606
8 ACTIVE org.eclipse.equinox.preferences_3.2.100.v20070
9 ACTIVE org.eclipse.equinox.registry_3.3.0.v20070522

Wolfgang
Re: Shutdown [message #100868 is a reply to message #100299] Fri, 02 November 2007 09:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: codex.magic-dreams.de

Does nobody have an idea?

> Hello,
>
> I have an application (Eclipse 3.3, implementing the IApplication
> interface). I run the application by specifying it in the config.ini.
> noShutdown and noExit are set to false. When I start osgi, the
> application is started, executes and exits. Unfortunately the framework
> is not stop. When I examine the active apps, my application is stopped.
> How can I trigger a complete shutdown from my application? I tried
> several methods:
> - System.exit works but I suppose this is not a clean an preferred way
> - EclipseStarter.shutdown also works, but I don't use it for starting so
> why should I use it for shutdown. Does that work? I also get a
> discouraged access warning for EclipseStarter.
>
> What is the correct way to do something like that?
>
> Thanks
> Wolfgang
Re: Shutdown [message #100882 is a reply to message #100299] Fri, 02 November 2007 09:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: stepper.sympedia.de

Wolfgang,

I can remember that it took me a while, too, to get my application
running properly. Do you declare your application to run on the main thread?

<extension
id="app"
point="org.eclipse.core.runtime.applications"
name="CDOServer">
<application cardinality="1" thread="main">
<run
class=" org.eclipse.emf.cdo.internal.server.bundle.CDOServerApplicat ion "/>
</application>
</extension>

Regards,
Eike Stepper
----
http://wiki.eclipse.org/?title=CDO
http://wiki.eclipse.org/?title=Net4j


Wolfgang Roessler schrieb:
> Hello,
>
> I have an application (Eclipse 3.3, implementing the IApplication
> interface). I run the application by specifying it in the config.ini.
> noShutdown and noExit are set to false. When I start osgi, the
> application is started, executes and exits. Unfortunately the
> framework is not stop. When I examine the active apps, my application
> is stopped. How can I trigger a complete shutdown from my application?
> I tried several methods:
> - System.exit works but I suppose this is not a clean an preferred way
> - EclipseStarter.shutdown also works, but I don't use it for starting
> so why should I use it for shutdown. Does that work? I also get a
> discouraged access warning for EclipseStarter.
>
> What is the correct way to do something like that?
>
> Thanks
> Wolfgang
Re: Shutdown [message #101061 is a reply to message #100454] Mon, 05 November 2007 17:00 Go to previous message
Thomas Watson is currently offline Thomas WatsonFriend
Messages: 503
Registered: July 2009
Senior Member
Wolfgang Roessler wrote:
> When I run with console, the thread output is:
>
> ThreadGroupType: Name: ParentGroup: MaxP: Threads:
> ThreadGroup main system 10 5/5
>
> ThreadType: Name: ThreadGroup: Prio:
> Thread DestroyJavaVM main 5
> Finalizer$Finalize Finalizer system 8 [daemon]
> EventManager$Event Framework Event Dispa main 5 [daemon]
> Thread OSGi Console main 5
> Reference$Referenc Reference Handler system 10 [daemon]
> Thread Signal Dispatcher system 9 [daemon]
> EventManager$Event Start Level Event Dis main 5 [daemon]
> Thread State Saver main 5
>
> ss outputs:
>
> Framework is launched.
>
> id State Bundle
> 0 ACTIVE org.eclipse.osgi_3.3.0.v20070530
> 1 ACTIVE org.eclipse.equinox.common_3.3.0.v20070426
> 2 ACTIVE org.eclipse.update.configurator_3.2.100.v20070
> 3 ACTIVE org.eclipse.core.runtime_3.3.100.v20070530
> 4 RESOLVED EquinoxTest1_1.0.0
> 5 <<LAZY>> org.eclipse.core.contenttype_3.2.100.v20070319
> 6 ACTIVE org.eclipse.core.jobs_3.3.0.v20070423
> 7 ACTIVE org.eclipse.equinox.app_1.0.0.v20070606
> 8 ACTIVE org.eclipse.equinox.preferences_3.2.100.v20070
> 9 ACTIVE org.eclipse.equinox.registry_3.3.0.v20070522
>
> Wolfgang

This indicates that the framework is not being shutdown at all. But I'm
not sure how this is possible. Could you please attach the debugger and
step through the shutdown process in EclipseStarter#run(String[],
Runnable) method. Make sure the shutdown() method is being called from
the finally block:

To attach a debugger you should be able to launch with something like this:

java -Xdebug
-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=800 0
org.eclipse.osgi_<version>.jar

Then you should be able to attach to the remote java process from your
eclipse.

Tom.
Previous Topic:Equinox and OSGi Webinar
Next Topic:Akwaard order of help for provided console commands
Goto Forum:
  


Current Time: Fri Apr 26 04:12:37 GMT 2024

Powered by FUDForum. Page generated in 0.03295 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top