Bug 232271 - Allow executable extensions to be lazy loaded
Summary: Allow executable extensions to be lazy loaded
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Runtime (show other bugs)
Version: 3.4   Edit
Hardware: PC All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: platform-runtime-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-15 06:50 EDT by Erdal Karaca CLA
Modified: 2019-09-06 16:11 EDT (History)
3 users (show)

See Also:


Attachments
Sample Class to handle lazy loading through dynamic proxies (917 bytes, text/plain)
2008-05-15 06:53 EDT, Erdal Karaca CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Erdal Karaca CLA 2008-05-15 06:50:57 EDT
Simple scenario:
A plugin creates objects whose classes are given through extension registry. If each object has its own class in different plugins, each of those plugins will be loaded by the framework. Often it is not appropriate to load all of those objects at once (and thus, the corresponding plugins).

Maybe, there would be a "simple" extension to IConfigurationElement.createExecutableExtension():

MyInterface lazyObject = element.createExecutableExtension( "class-attribute", MyInterface.class );

As you can see, createExecutableExtension() handles the creation of a proper object (e.g. through dynamic proxies).
Comment 1 Erdal Karaca CLA 2008-05-15 06:53:33 EDT
Created attachment 100406 [details]
Sample Class to handle lazy loading through dynamic proxies
Comment 2 Erdal Karaca CLA 2008-05-15 06:57:03 EDT
Use the LazyLoading class (from last attachment) as followed:

IConfigurationElement element = ...
MyInterface lazyObject =
    LazyLoader.newInstance( element.getAttribute( "class-attribute" ), MyInterface.class );
Comment 3 Oleg Besedin CLA 2008-07-14 09:56:26 EDT
Sorry, I don't quite see the benefit here.

"Old" way: use #createExecutableExtension()

"New" way: use (1) #createExecutableExtension() + (2) LazyLoader.newInstance()

If bundle activation is not desirable, when #createExecutableExtension() call cal be postponed until it is needed? It seems that the "new" way can be done today by doing nothing in place of (1) and doing #createExecutableExtension() in place of (2).

Comment 4 Erdal Karaca CLA 2008-07-14 10:54:14 EDT
The "trick" of this approach is not to postpone or just call createExecutableExtension when it is needed. Postponing means that the caller must handle the creation and add extra overhead to his structures/classes to remember the desired classes, e.g. add extra attributes to obtain the postponed IConfigurationElement.

This way, the caller does not need to deal with any extension registry api.
Comment 5 Erdal Karaca CLA 2008-07-16 15:40:23 EDT
Indeed, this was meant to be a "workaround" when I realized that there were a lot of plugins loaded just because there were executable extensions created by a central plugin.

First solution was to change a bunch of api to "postpone" the IConfigurationElement and let the caller decide on how to create the necessary objects. This was neither "elegent" nor safe to do since the api would have become cluttered by these IConfigurationElement attributes.

So, the easiest and yet safest way was to create dynamic proxies.

If you keep this in mind, you might understand why this approach might be worth to be available as a common feature.
Comment 6 Eclipse Webmaster CLA 2019-09-06 16:11:26 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.