Talk:NetbinoxPerformance

From APIDesign

(Difference between revisions)
Jump to: navigation, search
(Comment provided by Tom Watson - via ArticleComments extension)
Line 10: Line 10:
So if you had code like this:
So if you had code like this:
-
Bundle b = context.installBundle(
+
Bundle b = context.installBundle(
"file:/mybundles/someBundle.jar");
"file:/mybundles/someBundle.jar");
Then the content of /mybundles/someBundle.jar is copied into the framework cache as you have observed. But you can simply add a "reference:" to the front of your file: URL to have both Equinox and Felix read and use the content of the bundle without copying it into their own cache.
Then the content of /mybundles/someBundle.jar is copied into the framework cache as you have observed. But you can simply add a "reference:" to the front of your file: URL to have both Equinox and Felix read and use the content of the bundle without copying it into their own cache.
-
Bundle b = context.installBundle(
+
Bundle b = context.installBundle(
"reference:file:/mybundles/someBundle.jar");
"reference:file:/mybundles/someBundle.jar");
On Equinox (and I think Felix) you can also use reference: URLs to install bundles with opaque location string:
On Equinox (and I think Felix) you can also use reference: URLs to install bundles with opaque location string:
-
URL reference = new URL(
+
URL reference = new URL(
"reference:file:/mybundles/someBundle.jar");
"reference:file:/mybundles/someBundle.jar");
-
Bundle b = context.installBundle(
+
Bundle b = context.installBundle(
"mylocation", reference.openStream());
"mylocation", reference.openStream());

Revision as of 19:05, 2 April 2010

Comments on NetbinoxPerformance <comments />


Tom Watson said ...

Both Equinox and Felix support what folks call "reference" installs. This is done with a "reference" protocol handler.

So if you had code like this:

Bundle b = context.installBundle(
 "file:/mybundles/someBundle.jar");

Then the content of /mybundles/someBundle.jar is copied into the framework cache as you have observed. But you can simply add a "reference:" to the front of your file: URL to have both Equinox and Felix read and use the content of the bundle without copying it into their own cache.

Bundle b = context.installBundle(
 "reference:file:/mybundles/someBundle.jar");

On Equinox (and I think Felix) you can also use reference: URLs to install bundles with opaque location string:

URL reference = new URL(
 "reference:file:/mybundles/someBundle.jar");
Bundle b = context.installBundle(
 "mylocation", reference.openStream());

Care must be used when using reference installs. You must treat the path to the bundle content as owned by the framework as long as that bundle is installed in the framework. You are basically extending the framework cache out to some other path on your system.

Hope that Helps.

--Tom Watson 21:01, 2 April 2010 (CEST)

Personal tools
buy