dims 2002/09/25 17:24:50 Modified: java/src/org/apache/axis/encoding/ser BaseDeserializerFactory.java BaseSerializerFactory.java Log: One more try to fix performance degradation caused by fix for Bug 12741. Revision Changes Path 1.10 +5 -14 xml-axis/java/src/org/apache/axis/encoding/ser/BaseDeserializerFactory.java Index: BaseDeserializerFactory.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/BaseDeserializerFactory.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- BaseDeserializerFactory.java 25 Sep 2002 19:26:31 -0000 1.9 +++ BaseDeserializerFactory.java 26 Sep 2002 00:24:50 -0000 1.10 @@ -90,13 +90,17 @@ */ public BaseDeserializerFactory(Class deserClass) { this.deserClass = deserClass; + this.mechanisms = new Vector(); + this.mechanisms.add(Constants.AXIS_SAX); } public BaseDeserializerFactory(Class deserClass, QName xmlType, Class javaType) { - this.deserClass = deserClass; + this(deserClass); this.xmlType = xmlType; this.javaType = javaType; + this.deserClassConstructor = getConstructor(deserClass); + this.getDeserializer = getDeserializerMethod(javaType); } public javax.xml.rpc.encoding.Deserializer @@ -132,9 +136,6 @@ */ protected Deserializer getGeneralPurpose(String mechanismType) { if (javaType != null && xmlType != null) { - if (deserClassConstructor == null) { - deserClassConstructor = getConstructor(deserClass); - } if (deserClassConstructor != null) { try { return (Deserializer) @@ -165,12 +166,6 @@ */ protected Deserializer getSpecialized(String mechanismType) { if (javaType != null && xmlType != null) { - // Ensure that getDeserializerMethod is called only once. - synchronized (this) { - if (getDeserializer == null) { - getDeserializer = getDeserializerMethod(javaType); - } - } if (getDeserializer != null) { try { return (Deserializer) @@ -219,10 +214,6 @@ * @return List of unique identifiers for the supported XML processing mechanism types */ public Iterator getSupportedMechanismTypes() { - if (mechanisms == null) { - mechanisms = new Vector(); - mechanisms.add(Constants.AXIS_SAX); - } return mechanisms.iterator(); } 1.18 +20 -22 xml-axis/java/src/org/apache/axis/encoding/ser/BaseSerializerFactory.java Index: BaseSerializerFactory.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/BaseSerializerFactory.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- BaseSerializerFactory.java 25 Sep 2002 19:26:31 -0000 1.17 +++ BaseSerializerFactory.java 26 Sep 2002 00:24:50 -0000 1.18 @@ -112,34 +112,42 @@ } public BaseSerializerFactory(Class serClass, boolean share, QName xmlType, Class javaType) { - this.serClass = serClass; - this.share = share; + this(serClass, share); this.xmlType = xmlType; this.javaType = javaType; + this.serClassConstructor = getConstructor(serClass); + this.getSerializer = getSerializerMethod(javaType); } public javax.xml.rpc.encoding.Serializer getSerializerAs(String mechanismType) throws JAXRPCException { - // Need to add code to check against mechanisms vector. - if (share && ser != null) { + if (!share) { + return getSerializerAsInternal(mechanismType); + } + synchronized (this) { + if (ser==null) { + ser = getSerializerAsInternal(mechanismType); + } return ser; } - ser = null; - + } + + protected Serializer getSerializerAsInternal(String mechanismType) + throws JAXRPCException { // Try getting a specialized Serializer - ser = getSpecialized(mechanismType); + Serializer serializer = getSpecialized(mechanismType); // Try getting a general purpose Serializer via constructor // invocation - if (ser == null) { - ser = getGeneralPurpose(mechanismType); + if (serializer == null) { + serializer = getGeneralPurpose(mechanismType); } try { // If not successfull, try newInstance - if (ser == null) { - ser = (Serializer) serClass.newInstance(); + if (serializer == null) { + serializer = (Serializer) serClass.newInstance(); } } catch (Exception e) { throw new JAXRPCException( @@ -147,7 +155,7 @@ serClass.getName()), e); } - return ser; + return serializer; } /** @@ -156,10 +164,6 @@ */ protected Serializer getGeneralPurpose(String mechanismType) { if (javaType != null && xmlType != null) { - if (serClassConstructor == null) { - serClassConstructor = getConstructor(serClass); - } - if (serClassConstructor != null) { try { return (Serializer) @@ -190,12 +194,6 @@ */ protected Serializer getSpecialized(String mechanismType) { if (javaType != null && xmlType != null) { - // Ensure that getSerializerMethod is called only once. - synchronized (this) { - if (getSerializer == null) { - getSerializer = getSerializerMethod(javaType); - } - } if (getSerializer != null) { try { return (Serializer)