Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » How do I run OSGi as a daemon?
How do I run OSGi as a daemon? [message #86687] Fri, 13 April 2007 19:04 Go to next message
Bryan Hunt is currently offline Bryan HuntFriend
Messages: 366
Registered: July 2009
Senior Member
I'm playing with R-OSGi and I'd like OSGi to run as a daemon without
using the console. When I launch OSGi with -console, I can connect to
my remote service from a client and everything works. If I remove the
-console, OSGi will terminate. Looking at the config.ini generated by
PDE, osgi.noShutdown=true. Is there an interaction with running OSGi
from the Eclipse IDE that causes it to shutdown independent of the
noShutdown parm?

Bryan
Re: How do I run OSGi as a daemon? [message #86703 is a reply to message #86687] Sat, 14 April 2007 08:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: alex_blewitt.yahoo.com

You can specify -noExit on the command line to prevent it from terminating. In fact, the only reason why your networked console isn't terminating is because there's a thread servicing the network port; arguably, that should be a Daemon thread and it's a bug.

You can also have a bundle which starts a non-Daemon thread (to keep the JVM around) such that when that bundle terminates, the Daemon thread stops and thus the JVM goes down of natural causes. But you could also use the -noExit (which is equivalent to osgi.noShutDown=true) and then explicitly request a shutdown from inside the JVM by doing Bundles.getBundle(0).stop().

Alex.
Re: How do I run OSGi as a daemon? [message #86730 is a reply to message #86703] Mon, 16 April 2007 15:59 Go to previous messageGo to next message
Bryan Hunt is currently offline Bryan HuntFriend
Messages: 366
Registered: July 2009
Senior Member
Alex, I think you may have missed a detail in my post ...
osgi.noshutDown=true is set in the config.ini. I also tried -noExit as
a command line argument and it still exits.

Bryan


On 2007-04-13 23:18:01 -0500, Alex Blewitt <alex_blewitt@yahoo.com> said:

> You can specify -noExit on the command line to prevent it from
> terminating. In fact, the only reason why your networked console isn't
> terminating is because there's a thread servicing the network port;
> arguably, that should be a Daemon thread and it's a bug.
>
> You can also have a bundle which starts a non-Daemon thread (to keep
> the JVM around) such that when that bundle terminates, the Daemon
> thread stops and thus the JVM goes down of natural causes. But you
> could also use the -noExit (which is equivalent to
> osgi.noShutDown=true) and then explicitly request a shutdown from
> inside the JVM by doing Bundles.getBundle(0).stop().
>
> Alex.
Re: How do I run OSGi as a daemon? [message #86825 is a reply to message #86730] Mon, 16 April 2007 21:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: alex_blewitt.yahoo.com

No, I didn't miss that detail; I said that it's equivalent in my second paragraph.

What's in the log? Perhaps your bundle can't start up due to an unresolved dependency? What does -consoleLog say when you try to run it from the command line?

Alex.
Re: How do I run OSGi as a daemon? [message #86834 is a reply to message #86825] Mon, 16 April 2007 22:41 Go to previous messageGo to next message
Bryan Hunt is currently offline Bryan HuntFriend
Messages: 366
Registered: July 2009
Senior Member
Using -consoleLog prints nothing to the console.

Bryan


On 2007-04-16 12:43:23 -0500, Alex Blewitt <alex_blewitt@yahoo.com> said:

> No, I didn't miss that detail; I said that it's equivalent in my second
> paragraph.
>
> What's in the log? Perhaps your bundle can't start up due to an
> unresolved dependency? What does -consoleLog say when you try to run it
> from the command line?
>
> Alex.
Re: How do I run OSGi as a daemon? [message #86841 is a reply to message #86834] Tue, 17 April 2007 07:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: alex_blewitt.yahoo.com

Weird. How are you launching it? What's the full command line you specify to bring it up?

Alex.
Re: How do I run OSGi as a daemon? [message #86880 is a reply to message #86841] Tue, 17 April 2007 14:12 Go to previous messageGo to next message
Bryan Hunt is currently offline Bryan HuntFriend
Messages: 366
Registered: July 2009
Senior Member
I'm launching it from the Eclipse IDE. The only command line arguments
I've tried are what we've already discussed.

Bryan


On 2007-04-16 22:55:26 -0500, Alex Blewitt <alex_blewitt@yahoo.com> said:

> Weird. How are you launching it? What's the full command line you
> specify to bring it up?
>
> Alex.
Re: How do I run OSGi as a daemon? [message #86895 is a reply to message #86880] Tue, 17 April 2007 17:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: alex_blewitt.yahoo.com

Would have been helpful to know you were running a runtime PDE instance rather than from the command line earlier ...

You're running as an Equinox OSGi Framework or an Eclipse Application? I'm guessing the former. What are the start levels specified, and are your plugin(s) started?

Even with an empty plugin, I still don't get the framework going down on me in 3.2.2; the framework runs as expected. Even an exception in the Activator doesn't shut the framework down.

In short, I can't replicate what you are seeing.

What happens when you run it outside of Eclipse with a command line, instead of the PDE?

Alex.
Re: How do I run OSGi as a daemon? [message #86910 is a reply to message #86895] Tue, 17 April 2007 18:54 Go to previous message
Bryan Hunt is currently offline Bryan HuntFriend
Messages: 366
Registered: July 2009
Senior Member
From my original posting:

Is there an interaction with running OSGi from the Eclipse IDE that
causes it to shutdown independent of the noShutdown parm?

Yes, I'm running as an OSGi Framework. The default start level is set
to 4, a copule of bundles have a start level of 1, some 2, one 3, and
some the default. All of the bundles start just fine, and the
application works just fine if I specify -console.

I suppose I should try to replicate this with 3.2.2 - I've been doing
all of my testing with 3.3M6.

Bryan


On 2007-04-17 08:50:26 -0500, Alex Blewitt <alex_blewitt@yahoo.com> said:

> Would have been helpful to know you were running a runtime PDE instance
> rather than from the command line earlier ...
>
> You're running as an Equinox OSGi Framework or an Eclipse Application?
> I'm guessing the former. What are the start levels specified, and are
> your plugin(s) started?
>
> Even with an empty plugin, I still don't get the framework going down
> on me in 3.2.2; the framework runs as expected. Even an exception in
> the Activator doesn't shut the framework down.
>
> In short, I can't replicate what you are seeing.
>
> What happens when you run it outside of Eclipse with a command line,
> instead of the PDE?
>
> Alex.
Previous Topic:Re: Loading jar at runtime
Next Topic:Remote bundles
Goto Forum:
  


Current Time: Fri Apr 26 17:50:00 GMT 2024

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

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

Back to the top