Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Eclipse-BuddyPolicy: global question(eclipse buddy classloading global BuddyPolicy)
Eclipse-BuddyPolicy: global question [message #498962] Thu, 19 November 2009 10:46 Go to next message
Florin Bratu is currently offline Florin Bratu
Messages: 2
Registered: July 2009
Junior Member
Hello everyone,

I have a question related to the Eclipse buddy classloading mechanism. In particularly, I am interested in the global buddy policy. I have read at [1] that:
"global - Consults the available packages exported in the global pool of exported packages."

My question is: what does "global pool of exported packages" mean? Sorry this might seem like a newbie question, but all my searches through the documentation and through the Eclipse forums didn't help me to find the significance of this phrase.

Thanks,
Florin.

[1] http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhan cements
Re: Eclipse-BuddyPolicy: global question [message #499308 is a reply to message #498962] Fri, 20 November 2009 18:13 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

OSGi bundles export packages to make them available to other bundles. ex:
Export-Package: org.eclipse.core.tests.harness,
org.eclipse.core.tests.session,
org.eclipse.core.tests.session.samples

These go into the global pool of exported packages. There might be attributes that can be added that would prevent the packages from showing up in the global pool (but I'm not that familiar with extra attributes on exported packages).

PW


Re: Eclipse-BuddyPolicy: global question [message #499526 is a reply to message #499308] Mon, 23 November 2009 08:43 Go to previous messageGo to next message
Florin Bratu is currently offline Florin Bratu
Messages: 2
Registered: July 2009
Junior Member
Ok, I see now. Thank you for the reply. I thought that global meant available to everyone(all bundles) in the expression "global pool of exported packages".

But then, it is not clear to me the purpose of global buddy policy. It seems to me that Eclipse-BuddyPolicy:global is the same as using Bundle-ClassPath: and specifying the jars which contain the "global" packages.

How does Eclipse-BuddyPolicy:global differ, what are its advantages?

Thanks,
Florin.
Re: Eclipse-BuddyPolicy: global question [message #499620 is a reply to message #499526] Mon, 23 November 2009 14:51 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

then by specifying the buddy policy "global" you will see all exported packages in the global pool.

This is the equivalent of either listing all bundles in Require-Bundles or listing *all* packages in Import-Package. Except it would handle "new" bundles added to the system that your bundle cannot be aware of.

The advantage ... I think it's a hack to support 3rd party libraries that don't know about OSGi and use things like Class.forName(*). At least IMHO.

If you're OSGi aware you wouldn't do that.

PW


Re: Eclipse-BuddyPolicy: global question [message #500500 is a reply to message #499620] Thu, 26 November 2009 12:38 Go to previous message
Roland Tepp is currently offline Roland Tepp
Messages: 336
Registered: July 2009
Senior Member
23.11.2009 16:52, Paul Webster kirjutas:
> The advantage ... I think it's a hack to support 3rd party libraries
> that don't know about OSGi and use things like Class.forName(*). At
> least IMHO.
>
> If you're OSGi aware you wouldn't do that.
>

I would also warn against using BuddyPolicy if at all possible and
sticking to the most restrictive buddy policy possible, if not.

The experience has shown that using liberal BuddyPolicy can lead to
classloading deadlocks - and quite often these deadlocks manifest
themselves months later because of a seemingly small change will change
timing of class loading operations.

The issue with BuddyPolicy is that it inadvertently breaks the bundle
class loading hierarchy and can cause subtle but fatal dependency cycles
between bundles, which can lead to bundle class loaders acuiring locks
in an unpredictable order and getting into deadlock with another class
loading operation.

There is also a preformance issue that when a class needs to be loaded,
the more liberal the BuddyPolicy, the wider is the class name search
path on each class load.

One of the side-effects of a buddy policy is also that it may braks
Eclipse lazy-loading paradigm, by activating all bundles that get
visited due to the class loading request.

Don't mistake me - sometimes using BuddyPolicy is unavoidable, but You
must be aware that there be dragons under that road and tread with due
caution...

--
Roland Tepp
Previous Topic:Start Equinox programmatically within web app
Next Topic:Building a standalone Equinox application
Goto Forum:
  


Current Time: Thu Oct 30 18:33:29 GMT 2014

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

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