dev@glassfish.java.net

[Discuss]About Ondemand Provisioning Of OSGi Modules

From: Tang Yong <tangyong_at_cn.fujitsu.com>
Date: Wed, 29 Aug 2012 19:04:46 +0900

Hi Sahoo

  Please tolerate following my long contents.

  Remembering on previous thread, Sahoo ever said:

>This is a work in progress. I have implemented this to some extent in
>trunk. I call this "on demand" mode. You can try it out by setting
>glassfish.osgi.ondemand=true in glassfish/config/osgi.properties.

Today, I have tried the mode and found some interesting topics and some
problems and want to discuss with you.

Firstly, let us see the running result after setting
"glassfish.osgi.ondemand=true".

1 About provisioned bundles

After setting "glassfish.osgi.ondemand=true", the location of installed
bundles still came from the following positions:

1) modules/endorsed/
2) modules/
3) modules/autostart/

However, I found a interesting problem after diffing the results of
"glassfish.osgi.ondemand=true" and "glassfish.osgi.ondemand=false",

After setting "glassfish.osgi.ondemand=true", the bundle of
modules/exception-annotation-processor.jar (0.0.0) has been not
installed. Is it a bug?

In addition, After entering felix shell and executing lb command, I
found that there are two bundles[1][2] which display the same bundle
description("Admin Console Integration (4.0.0.SNAPSHOT)").
[1]gf-admingui-connector.jar
[2]console-plugin-service.jar
As a litter suggestion, I wish team can improve "Bundle Name" of the two
bundles in order not to confuse the user.

2 About the provisioning.properties

Default, Glassfish has not offered such a file, however, after setting
"glassfish.osgi.ondemand=true" and executing start-domain command, under
osgi-cache\felix\bundle0 directory which hosts system bundle, a
provisioning.properties file will be auto-generated and records some
important configurations, such as "lassfish.osgi.auto.install",
"glassfish.osgi.start.level.final" ....

However, I found that the value[3] of "glassfish.osgi.auto.install"
seemed to be a litter strange. Why osgi-resource-locator.jar needs to be
listed alone?

[3]glassfish.osgi.auto.install=file\:/.../modules/endorsed/
file\:/.../modules/osgi-resource-locator.jar file\:/.../modules/
file\:/...modules/autostart/

3 About location of provisioned bundles

After setting "glassfish.osgi.ondemand=true", I found that under
osgi-cache\felix dirctory, some bundles's locations(recorded in
bundle.info file) start with "file:/..." , other bundles's locations
start with "obr://..." . I want to know whether having some rule to do
it or not? In addition, I guess that because of setting
"glassfish.osgi.ondemand=true" , the value of
"com.sun.enterprise.hk2.obrEnabled " is also true, so Glassfish(HK2
Layer) used OBR to provision some bundles. But I have not seen created
obr.xml.

Secondly, I want to say my understanding of "Ondemand Provisioning".
I wish to implement such a mode:

When starting glassfish domain, only loading(install and start)
Glassfish Kernel related modules(including HK2...), and Admin related
modules used to control domain, and user specified modules.

If user has not specified more modules other than Kernel and Admin
related modules, glassfish only loads Kernel and Admin related modules.
Such a way maybe improve performance of staring glassfish and save more
resouces greatly which maybe meet some demands of cloud scene.

Then, after starting glassfish, glassfish should also offer a means to
load more modules on demand if lately a user wants to use the
modules-related technology. For example, if lately the user want to use
ejb-related technology, glassfish should offer a means (for example,
start ejb container related modules alone, using deploy command with
more options or a provisioning related file to provioning dynamiclly... ) .

In order to reach the mode, I think that we need to divide each
technology related bundles and dependent bundles, then make some
configurations, of course, it is not a simple thing.

I have seen a trend that if glassfish will integrate more and more other
frameworks(etc. Apache DCXF,...) which depend on more third-party
bundles, installed and started bundles will become more and more...

--Tang