<html>
    <head>
      <base href="http://www.jacorb.org/bugzilla/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Converting a repository id to a class name can take a long time"
   href="http://www.jacorb.org/bugzilla/show_bug.cgi?id=962">962</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Converting a repository id to a class name can take a long time
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>JacORB
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.3
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P5
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Interface Repository
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>jacorb-bugs@lists.spline.inf.fu-berlin.de
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>mesnier_p@ociweb.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=425&action=diff" name="attach_425" title="The fix">attachment 425</a> <a href="attachment.cgi?id=425&action=edit" title="The fix">[details]</a></span>
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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>