axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From keith chapman <keithgchap...@gmail.com>
Subject Axis2 API design issue, Should we fix it?
Date Tue, 05 May 2009 11:45:52 GMT
Hi all,

Due to a design issue in the Axis2 API we have implemented the getServices()
method as follows,

public HashMap<String, AxisService> getServices() {
        HashMap<String, AxisService> hashMap = new HashMap<String,
AxisService>(this.allServices.size());
        String key;
        for (Iterator<String> iter = this.allServices.keySet().iterator();
iter.hasNext();){
            key = iter.next();
            hashMap.put(key, this.allServices.get(key));
        }
        return hashMap;
    }

In my view this is highly inefficient, especially if you have plenty of
services in the system. Wouldn't it be better to fix the API and return a
Map instead of a HashMap? If we did that we could simple return allServices
instead of returning a copy of it.

If we are making this change I propose that we fix this for modules,
transports as well.

Thanks,
Keith.




-- 
Keith Chapman
Senior Software Engineer
WSO2 Inc.
Oxygenating the Web Service Platform.
http://wso2.org/

blog: http://www.keith-chapman.org

Mime
View raw message