Read only archive ; use https://github.com/JacORB/JacORB/issues for new issues
Bug 962 - Converting a repository id to a class name can take a long time
Summary: Converting a repository id to a class name can take a long time
Status: RESOLVED FIXED
Alias: None
Product: JacORB
Classification: Unclassified
Component: Interface Repository (show other bugs)
Version: 3.3
Hardware: PC All
: P5 enhancement
Assignee: Mailinglist to track bugs
URL:
Depends on:
Blocks:
 
Reported: 2013-08-08 18:57 UTC by Phil Mesnier
Modified: 2013-09-09 02:42 UTC (History)
1 user (show)

See Also:


Attachments
The fix (3.96 KB, patch)
2013-08-08 18:57 UTC, Phil Mesnier
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Phil Mesnier 2013-08-08 18:57:47 UTC
Created attachment 425 [details]
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.
Comment 1 Nick Cross 2013-09-09 02:42:23 UTC
Modified patch applied after discussion.