axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Poon (JIRA)" <>
Subject [jira] Updated: (AXIS2-3400) AxisService name not unique enough
Date Thu, 14 Feb 2008 23:21:08 GMT


David Poon updated AXIS2-3400:

We have implemented our own local fix to InterfaceImplementationTemplate.xsl. Performance
and stress test runs on a multi-cpu Solaris 8 host indictate that we have solved this issue;
i.e., we do not get "duplicate service name" errors anymore.

We are now proposing to the Axis2 team that the fix to InterfaceImplementationTemplate.xsl
should be as follows (note that the getUniqueSuffix method is *static* and *synchronized*):

private static int counter = 0;
private static synchronized int getUniqueSuffix() {
    // reset the counter if it is greater than 99999
    if (counter > 99999) {
        counter = 0;
    counter = counter + 1;
    return counter;
private String getCurrentTime() {
    return (Long.toString(System.currentTimeMillis()) + "_");

private void populateAxisService() throws org.apache.axis2.AxisFault {

     //creating the Service with a unique name
     _service = new org.apache.axis2.description.AxisService("<xsl:value-of select="@servicename"/>"
+ getCurrentTime() + Integer.toString(getUniqueSuffix()));

> AxisService name not unique enough
> ----------------------------------
>                 Key: AXIS2-3400
>                 URL:
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 1.3
>            Reporter: David Poon
>            Assignee: Amila Chinthaka Suriarachchi
>            Priority: Blocker
> The generated (client) stub implementation's populateAxisService() method creates the
AxisService name using Object.hashCode() as a means to "ensure" uniqueness, for example:
> //creating the Service with a unique name
> _service = new org.apache.axis2.description.AxisService("IsisLocation" + this.hashCode());
> In our performance and stress test runs, we find that from time to time, "duplicate name
found" errors would occur. We reuse the same configuration context instance over multiple
client service invocations. The javadoc of java.lang.Object.hashCode() states that:
> "... It is not required that if two objects are unequal according to the java.lang.Object.equals(java.lang.Object)
method, then calling the hashCode method on each of the two objects must produce distinct
integer results. ... As much as is reasonably practical, the hashCode method defined by class
Object does return distinct integers for distinct objects. (This is typically implemented
by converting the internal address of the object into an integer, but this implementation
technique is not required by the JavaTM programming language.)"
> In essence uniqueness is not guaranteed.
> Even though the Stub's finalize() method calls its own cleanup() method (which would
remove the AxisService name), it is still possible for a duplicate name being generated whilst
the other Stub is still in use (by another thread).
> Perhaps in addition to using hashCode(), a static incrementing counter could be appended
to the generated name as well?

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

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message