Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] Re-starting Equinox programmatically

From: Richard Hall <heavy@xxxxxxxxxxxxxx>
Reply-To: Equinox development mailing list <equinox-dev@xxxxxxxxxxx>
Date: Wednesday, May 30, 2012 4:09 PM
To: Equinox development mailing list <equinox-dev@xxxxxxxxxxx>
Subject: Re: [equinox-dev] Re-starting Equinox programmatically

I think calling refresh or update on the system bundle is supposed to restart the framework.

That's not the same kind of refresh. I am trying to change framework properties, which are immutable for a framework instance and require a new instance to be created from the factory. During the creation, the configuration is passed. However, Equinox internally uses a static FrameworkProperties class variable to store the properties and in its logic switches the framework class loader when it detects that it was already configured. There is no way to un-set the properties in that class and it is loaded by the AppClassLoader, so doesn't get reloaded either.


On 5/30/12 5:06 PM, Tim Diekmann wrote:
Hi,

I am looking for a way to re-start the Equinox framework after it has been started and stopped successfully.

In an initial attempt, I use the ServiceLoader to get the EquinoxFactory and produce an Equinox instance. First start works fine.
While this is all available from the standard spec, what makes my question specific to Equinox is the fact that I configure an AdapterHook in the launch properties.

Now, when I stop the instance and re-create it using the factory, the Equinox Framework throws a ClassCastException during initialization of the AdapterHooks as my private hook comes from a different class loader.
During debugging I found that Equinox switched the class loader on the second attempt, because the static FrameworkProperties class has already created the properties and therefore switched the class loader.

How it this supposed to work? How can you use the OSGi launch spec and restart Equinox programmatically?

Thanks,

  Tim.



_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxxhttps://dev.eclipse.org/mailman/listinfo/equinox-dev

Back to the top