[jacorb-bugs] [Bug 962] New: Converting a repository id to a class name can take a long time

bugzilla-daemon at jacorb.org bugzilla-daemon at jacorb.org
Fri Aug 9 00:57:47 CEST 2013


http://www.jacorb.org/bugzilla/show_bug.cgi?id=962

            Bug ID: 962
           Summary: Converting a repository id to a class name can take a
                    long time
           Product: JacORB
           Version: 3.3
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P5
         Component: Interface Repository
          Assignee: jacorb-bugs at lists.spline.inf.fu-berlin.de
          Reporter: mesnier_p at ociweb.com

Created attachment 425
  --> http://www.jacorb.org/bugzilla/attachment.cgi?id=425&action=edit
The fix

There is a very old utility function, RepositoryID.ir2scope() that takes a
string of the form "mod1/mod2/mod3/intf/MyExcept" and returns a fully qualified
class name string: "mod1.mod2.mod3.intfPackage.MyExcept"

The way it determines that "intf" needs to become "intfPackage" is by using the
class loader to first try to load "mod1" then "mod1.mod2" etc. If the class
path the loader searches is large, this iteration can take a long time, perhaps
seconds. Also, it happens every time the repoID is used, so repeated use, such
as from a request interceptor, can incur substantial overhead.

My solution is to first use a map to store successful conversions. I'm using a
concurrentHashMap, which may impose synchronization, but that is better than
always hitting the class loader. Second, the class loader is still used, but
now no more than twice. Once to try the FQ class name resulting from a simple
'/'->'.' conversion, and if that fails, insert "Package" before the last dot
and try again. If that still fails, the "Package" is abandoned and the name is
returned. This preserves the semantics of the call.

I have not been able to construct an IDL file that will generate a "Package"
within a "Package". If that can be demonstrated, please attach a test and I
will modify my code to continue adding "Package" names as necessary.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spline.inf.fu-berlin.de/pipermail/jacorb-bugs/attachments/20130808/00f8f65d/attachment.html>


More information about the jacorb-bugs mailing list