You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by "Roland Huss (JIRA)" <ji...@apache.org> on 2010/01/08 11:32:54 UTC

[jira] Created: (ARIES-108) bundle.getBundleContext().getBundles() throws NPE on INSTALLED Bundles

bundle.getBundleContext().getBundles() throws NPE on INSTALLED Bundles
----------------------------------------------------------------------

                 Key: ARIES-108
                 URL: https://issues.apache.org/jira/browse/ARIES-108
             Project: Aries
          Issue Type: Bug
          Components: JMX
    Affects Versions: Incubation
            Reporter: Roland Huss
            Priority: Critical


Within FrameworkUtils when extracting imported packages or dependencies
this is done by looking up all bundles via the Bundle's BundleContext. 
Unfortunately  bundle.getBundleContext() returns null for resolved bundles.

One can workaround by checking for null, but this will nevertheless miss
Bundles in certain states.

BTW, I agree that the dependency resolution via iteration for each 
JMX call is ugly (and expensive!). There must be a better way ....

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ARIES-108) bundle.getBundleContext().getBundles() throws NPE on INSTALLED Bundles

Posted by "Jeremy Hughes (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ARIES-108?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jeremy Hughes updated ARIES-108:
--------------------------------

    Fix Version/s: 0.1

> bundle.getBundleContext().getBundles() throws NPE on INSTALLED Bundles
> ----------------------------------------------------------------------
>
>                 Key: ARIES-108
>                 URL: https://issues.apache.org/jira/browse/ARIES-108
>             Project: Aries
>          Issue Type: Bug
>          Components: JMX
>    Affects Versions: Incubation
>            Reporter: Roland Huss
>            Assignee: Alan Keane
>            Priority: Critical
>             Fix For: 0.1
>
>         Attachments: patch.txt
>
>
> Within FrameworkUtils when extracting imported packages or dependencies
> this is done by looking up all bundles via the Bundle's BundleContext. 
> Unfortunately  bundle.getBundleContext() returns null for non-resolved bundles.
> One can workaround this by checking for null, but this will nevertheless miss
> Bundles in certain states.
> BTW, I agree that the dependency resolution via iteration for each 
> JMX call is ugly (and expensive!). There must be a better way ....

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ARIES-108) bundle.getBundleContext().getBundles() throws NPE on INSTALLED Bundles

Posted by "Roland Huss (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ARIES-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12798480#action_12798480 ] 

Roland Huss commented on ARIES-108:
-----------------------------------

FYI, I did a quick Benchmark on osgi.core:type=bundleState,version=1.5  operation 'listBundles' on a 'naked' Felix installation 
a fully crowded Glassfish v3 (MBP 2.4 GHz, 4 GB)

Glassfish v3, 248 Bundles --> Execution time: 6664ms (26.8 ms per Bundle)
Felix, 10 Bundles --> Execution time: 133 ms (13.3 ms per Bundle)

As expected, the average time per bundle increases with the number of bundles with
the current implementation.



> bundle.getBundleContext().getBundles() throws NPE on INSTALLED Bundles
> ----------------------------------------------------------------------
>
>                 Key: ARIES-108
>                 URL: https://issues.apache.org/jira/browse/ARIES-108
>             Project: Aries
>          Issue Type: Bug
>          Components: JMX
>    Affects Versions: Incubation
>            Reporter: Roland Huss
>            Assignee: Alan Keane
>            Priority: Critical
>         Attachments: patch.txt
>
>
> Within FrameworkUtils when extracting imported packages or dependencies
> this is done by looking up all bundles via the Bundle's BundleContext. 
> Unfortunately  bundle.getBundleContext() returns null for non-resolved bundles.
> One can workaround this by checking for null, but this will nevertheless miss
> Bundles in certain states.
> BTW, I agree that the dependency resolution via iteration for each 
> JMX call is ugly (and expensive!). There must be a better way ....

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (ARIES-108) bundle.getBundleContext().getBundles() throws NPE on INSTALLED Bundles

Posted by "Alan Keane (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ARIES-108?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alan Keane reassigned ARIES-108:
--------------------------------

    Assignee: Alan Keane

> bundle.getBundleContext().getBundles() throws NPE on INSTALLED Bundles
> ----------------------------------------------------------------------
>
>                 Key: ARIES-108
>                 URL: https://issues.apache.org/jira/browse/ARIES-108
>             Project: Aries
>          Issue Type: Bug
>          Components: JMX
>    Affects Versions: Incubation
>            Reporter: Roland Huss
>            Assignee: Alan Keane
>            Priority: Critical
>         Attachments: patch.txt
>
>
> Within FrameworkUtils when extracting imported packages or dependencies
> this is done by looking up all bundles via the Bundle's BundleContext. 
> Unfortunately  bundle.getBundleContext() returns null for non-resolved bundles.
> One can workaround this by checking for null, but this will nevertheless miss
> Bundles in certain states.
> BTW, I agree that the dependency resolution via iteration for each 
> JMX call is ugly (and expensive!). There must be a better way ....

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ARIES-108) bundle.getBundleContext().getBundles() throws NPE on INSTALLED Bundles

Posted by "Roland Huss (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ARIES-108?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Roland Huss updated ARIES-108:
------------------------------

    Description: 
Within FrameworkUtils when extracting imported packages or dependencies
this is done by looking up all bundles via the Bundle's BundleContext. 
Unfortunately  bundle.getBundleContext() returns null for non-resolved bundles.

One can workaround this by checking for null, but this will nevertheless miss
Bundles in certain states.

BTW, I agree that the dependency resolution via iteration for each 
JMX call is ugly (and expensive!). There must be a better way ....

  was:
Within FrameworkUtils when extracting imported packages or dependencies
this is done by looking up all bundles via the Bundle's BundleContext. 
Unfortunately  bundle.getBundleContext() returns null for resolved bundles.

One can workaround by checking for null, but this will nevertheless miss
Bundles in certain states.

BTW, I agree that the dependency resolution via iteration for each 
JMX call is ugly (and expensive!). There must be a better way ....


> bundle.getBundleContext().getBundles() throws NPE on INSTALLED Bundles
> ----------------------------------------------------------------------
>
>                 Key: ARIES-108
>                 URL: https://issues.apache.org/jira/browse/ARIES-108
>             Project: Aries
>          Issue Type: Bug
>          Components: JMX
>    Affects Versions: Incubation
>            Reporter: Roland Huss
>            Priority: Critical
>         Attachments: patch.txt
>
>
> Within FrameworkUtils when extracting imported packages or dependencies
> this is done by looking up all bundles via the Bundle's BundleContext. 
> Unfortunately  bundle.getBundleContext() returns null for non-resolved bundles.
> One can workaround this by checking for null, but this will nevertheless miss
> Bundles in certain states.
> BTW, I agree that the dependency resolution via iteration for each 
> JMX call is ugly (and expensive!). There must be a better way ....

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Work started: (ARIES-108) bundle.getBundleContext().getBundles() throws NPE on INSTALLED Bundles

Posted by "Alan Keane (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ARIES-108?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Work on ARIES-108 started by Alan Keane.

> bundle.getBundleContext().getBundles() throws NPE on INSTALLED Bundles
> ----------------------------------------------------------------------
>
>                 Key: ARIES-108
>                 URL: https://issues.apache.org/jira/browse/ARIES-108
>             Project: Aries
>          Issue Type: Bug
>          Components: JMX
>    Affects Versions: Incubation
>            Reporter: Roland Huss
>            Assignee: Alan Keane
>            Priority: Critical
>         Attachments: patch.txt
>
>
> Within FrameworkUtils when extracting imported packages or dependencies
> this is done by looking up all bundles via the Bundle's BundleContext. 
> Unfortunately  bundle.getBundleContext() returns null for non-resolved bundles.
> One can workaround this by checking for null, but this will nevertheless miss
> Bundles in certain states.
> BTW, I agree that the dependency resolution via iteration for each 
> JMX call is ugly (and expensive!). There must be a better way ....

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ARIES-108) bundle.getBundleContext().getBundles() throws NPE on INSTALLED Bundles

Posted by "Alan Keane (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ARIES-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12798882#action_12798882 ] 

Alan Keane commented on ARIES-108:
----------------------------------

Thanks for checking and the quick response!

(No caching added to JMX Core, there may be a slight gain at the framework level on the second invocation)

> bundle.getBundleContext().getBundles() throws NPE on INSTALLED Bundles
> ----------------------------------------------------------------------
>
>                 Key: ARIES-108
>                 URL: https://issues.apache.org/jira/browse/ARIES-108
>             Project: Aries
>          Issue Type: Bug
>          Components: JMX
>    Affects Versions: Incubation
>            Reporter: Roland Huss
>            Assignee: Alan Keane
>            Priority: Critical
>         Attachments: patch.txt
>
>
> Within FrameworkUtils when extracting imported packages or dependencies
> this is done by looking up all bundles via the Bundle's BundleContext. 
> Unfortunately  bundle.getBundleContext() returns null for non-resolved bundles.
> One can workaround this by checking for null, but this will nevertheless miss
> Bundles in certain states.
> BTW, I agree that the dependency resolution via iteration for each 
> JMX call is ugly (and expensive!). There must be a better way ....

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ARIES-108) bundle.getBundleContext().getBundles() throws NPE on INSTALLED Bundles

Posted by "Roland Huss (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ARIES-108?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Roland Huss updated ARIES-108:
------------------------------

    Attachment: patch.txt

Patch for avoiding NPEs (but still missing bundles)

> bundle.getBundleContext().getBundles() throws NPE on INSTALLED Bundles
> ----------------------------------------------------------------------
>
>                 Key: ARIES-108
>                 URL: https://issues.apache.org/jira/browse/ARIES-108
>             Project: Aries
>          Issue Type: Bug
>          Components: JMX
>    Affects Versions: Incubation
>            Reporter: Roland Huss
>            Priority: Critical
>         Attachments: patch.txt
>
>
> Within FrameworkUtils when extracting imported packages or dependencies
> this is done by looking up all bundles via the Bundle's BundleContext. 
> Unfortunately  bundle.getBundleContext() returns null for resolved bundles.
> One can workaround by checking for null, but this will nevertheless miss
> Bundles in certain states.
> BTW, I agree that the dependency resolution via iteration for each 
> JMX call is ugly (and expensive!). There must be a better way ....

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ARIES-108) bundle.getBundleContext().getBundles() throws NPE on INSTALLED Bundles

Posted by "Alan Keane (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ARIES-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12798002#action_12798002 ] 

Alan Keane commented on ARIES-108:
----------------------------------

The JMX Core BundleContext can be passed and used for the getBundles() call which should resolve the problem.
Thanks for the patch.

> bundle.getBundleContext().getBundles() throws NPE on INSTALLED Bundles
> ----------------------------------------------------------------------
>
>                 Key: ARIES-108
>                 URL: https://issues.apache.org/jira/browse/ARIES-108
>             Project: Aries
>          Issue Type: Bug
>          Components: JMX
>    Affects Versions: Incubation
>            Reporter: Roland Huss
>            Priority: Critical
>         Attachments: patch.txt
>
>
> Within FrameworkUtils when extracting imported packages or dependencies
> this is done by looking up all bundles via the Bundle's BundleContext. 
> Unfortunately  bundle.getBundleContext() returns null for non-resolved bundles.
> One can workaround this by checking for null, but this will nevertheless miss
> Bundles in certain states.
> BTW, I agree that the dependency resolution via iteration for each 
> JMX call is ugly (and expensive!). There must be a better way ....

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (ARIES-108) bundle.getBundleContext().getBundles() throws NPE on INSTALLED Bundles

Posted by "Alan Keane (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ARIES-108?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alan Keane resolved ARIES-108.
------------------------------

    Resolution: Fixed

I've raised the question on the dev list in relation to the dependency resolution.
Will raise another issue to introduce if there is a more efficient way of resolving.

> bundle.getBundleContext().getBundles() throws NPE on INSTALLED Bundles
> ----------------------------------------------------------------------
>
>                 Key: ARIES-108
>                 URL: https://issues.apache.org/jira/browse/ARIES-108
>             Project: Aries
>          Issue Type: Bug
>          Components: JMX
>    Affects Versions: Incubation
>            Reporter: Roland Huss
>            Assignee: Alan Keane
>            Priority: Critical
>         Attachments: patch.txt
>
>
> Within FrameworkUtils when extracting imported packages or dependencies
> this is done by looking up all bundles via the Bundle's BundleContext. 
> Unfortunately  bundle.getBundleContext() returns null for non-resolved bundles.
> One can workaround this by checking for null, but this will nevertheless miss
> Bundles in certain states.
> BTW, I agree that the dependency resolution via iteration for each 
> JMX call is ugly (and expensive!). There must be a better way ....

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ARIES-108) bundle.getBundleContext().getBundles() throws NPE on INSTALLED Bundles

Posted by "Roland Huss (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ARIES-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12798848#action_12798848 ] 

Roland Huss commented on ARIES-108:
-----------------------------------

In fact, listBundles works much faster (10 times for Glassfish) now with the same setup:

Glassfish v3, 223 Bundles (not 248 as stated above,sorry) --> Execution time: 534ms 
Felix, 10 Bundles -> Execution time: 115ms

A second invocation on Glassfish v3 works even faster: 316ms (though I don't know why, maybe 
some internal caching ?)

All numbers where taken via System.currentTimeMillis() (nearly) before and after the (local) JMX call.
There is probably some constant overhead involved, but it seems that the 
execution times scale nearly linearly with the number of bundles installed.

Thanks for the excellent work, I really appreciate it!

> bundle.getBundleContext().getBundles() throws NPE on INSTALLED Bundles
> ----------------------------------------------------------------------
>
>                 Key: ARIES-108
>                 URL: https://issues.apache.org/jira/browse/ARIES-108
>             Project: Aries
>          Issue Type: Bug
>          Components: JMX
>    Affects Versions: Incubation
>            Reporter: Roland Huss
>            Assignee: Alan Keane
>            Priority: Critical
>         Attachments: patch.txt
>
>
> Within FrameworkUtils when extracting imported packages or dependencies
> this is done by looking up all bundles via the Bundle's BundleContext. 
> Unfortunately  bundle.getBundleContext() returns null for non-resolved bundles.
> One can workaround this by checking for null, but this will nevertheless miss
> Bundles in certain states.
> BTW, I agree that the dependency resolution via iteration for each 
> JMX call is ugly (and expensive!). There must be a better way ....

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ARIES-108) bundle.getBundleContext().getBundles() throws NPE on INSTALLED Bundles

Posted by "Alan Keane (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ARIES-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12798834#action_12798834 ] 

Alan Keane commented on ARIES-108:
----------------------------------

Hi Roland,

I've made an update for #getImportedPackages and #getRequiredBundles that will parse the corresponding manfiest headers and then use 
those values to query PackageAdmin.
When Dynamic Imports are used however, the full iteration will still be performed.
If you get a chance sometime, I would be interested to know if there is any significant improvement on listBundles() for above

Thanks,
Alan

> bundle.getBundleContext().getBundles() throws NPE on INSTALLED Bundles
> ----------------------------------------------------------------------
>
>                 Key: ARIES-108
>                 URL: https://issues.apache.org/jira/browse/ARIES-108
>             Project: Aries
>          Issue Type: Bug
>          Components: JMX
>    Affects Versions: Incubation
>            Reporter: Roland Huss
>            Assignee: Alan Keane
>            Priority: Critical
>         Attachments: patch.txt
>
>
> Within FrameworkUtils when extracting imported packages or dependencies
> this is done by looking up all bundles via the Bundle's BundleContext. 
> Unfortunately  bundle.getBundleContext() returns null for non-resolved bundles.
> One can workaround this by checking for null, but this will nevertheless miss
> Bundles in certain states.
> BTW, I agree that the dependency resolution via iteration for each 
> JMX call is ugly (and expensive!). There must be a better way ....

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ARIES-108) bundle.getBundleContext().getBundles() throws NPE on INSTALLED Bundles

Posted by "Roland Huss (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ARIES-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12798404#action_12798404 ] 

Roland Huss commented on ARIES-108:
-----------------------------------

Thanks for the fast fix, works fine for me. 



> bundle.getBundleContext().getBundles() throws NPE on INSTALLED Bundles
> ----------------------------------------------------------------------
>
>                 Key: ARIES-108
>                 URL: https://issues.apache.org/jira/browse/ARIES-108
>             Project: Aries
>          Issue Type: Bug
>          Components: JMX
>    Affects Versions: Incubation
>            Reporter: Roland Huss
>            Assignee: Alan Keane
>            Priority: Critical
>         Attachments: patch.txt
>
>
> Within FrameworkUtils when extracting imported packages or dependencies
> this is done by looking up all bundles via the Bundle's BundleContext. 
> Unfortunately  bundle.getBundleContext() returns null for non-resolved bundles.
> One can workaround this by checking for null, but this will nevertheless miss
> Bundles in certain states.
> BTW, I agree that the dependency resolution via iteration for each 
> JMX call is ugly (and expensive!). There must be a better way ....

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.