felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jesse Glick (JIRA)" <j...@apache.org>
Subject [jira] [Created] (FELIX-3478) BundleWiringImpl.getResourceByDelegation uses exceptions internally -> unnecessarily slow
Date Tue, 24 Apr 2012 02:28:34 GMT
Jesse Glick created FELIX-3478:
----------------------------------

             Summary: BundleWiringImpl.getResourceByDelegation uses exceptions internally
-> unnecessarily slow
                 Key: FELIX-3478
                 URL: https://issues.apache.org/jira/browse/FELIX-3478
             Project: Felix
          Issue Type: Bug
          Components: Framework
    Affects Versions: framework-4.0.2
         Environment: JDK 7, Ubuntu
            Reporter: Jesse Glick
            Priority: Minor


Noticed a Felix-based app freezing in the event thread for a long time during startup, while
looking for locale variants of an icon (most of which do not exist):

"AWT-EventQueue-0" prio=10 tid=0x0912c400 nid=0x2612 runnable [0xd4f0a000]
   java.lang.Thread.State: RUNNABLE
	at java.lang.Throwable.fillInStackTrace(Native Method)
	at java.lang.Throwable.fillInStackTrace(Throwable.java:782)
	- locked <0xd882a250> (a org.apache.felix.framework.resolver.ResourceNotFoundException)
	at java.lang.Throwable.<init>(Throwable.java:265)
	at java.lang.Exception.<init>(Exception.java:66)
	at org.apache.felix.framework.resolver.ResourceNotFoundException.<init>(ResourceNotFoundException.java:25)
	at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1465)
	at org.apache.felix.framework.BundleWiringImpl.getResourceByDelegation(BundleWiringImpl.java:1360)
	at org.apache.felix.framework.Felix.getBundleResource(Felix.java:1514)
	at org.apache.felix.framework.BundleImpl.getResource(BundleImpl.java:628)

Bundle.getResource can simply return null when the resource does not exist. Constructing a
ResourceNotFoundException internally is a waste of time.

Best would be for findClassOrResourceByDelegation and similar methods to just return null.
If you insist on exception-based control flow, at least override fillInStackTrace in RNFE
to do nothing, so it is cheaper.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message