Hi Dims, Good catch! That was by oversight, not by design. Fixing it now.
Thanks again! Thanks, Jeff IBM Software Group - WebSphere Web Services Development Phone: 512-838-4587 or Tie Line 678-4587 Internet e-mail and Sametime ID: [EMAIL PROTECTED] Davanum Srinivas <[EMAIL PROTECTED]> 03/29/2008 04:09 PM To [EMAIL PROTECTED] cc Axis developer list <[email protected]> Subject synchronized (this) (Re: svn commit: r642603 - in /webservices/axis2/trunk/java/modules: jaxws-integration/test/org/apache/axis2/jaxws/sample/parallelasync/server/ metadata/src/org/apache/axis2/jaxws/description/impl/) -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Jeff, Just curious, I see a "synchronized(this)" around initializeDispatchableOperationsList only in getDispatchableOperation and not in getDispatchableOperations. Is this by design? thanks, dims [EMAIL PROTECTED] wrote: | Author: barrettj | Date: Sat Mar 29 13:41:09 2008 | New Revision: 642603 | | URL: http://svn.apache.org/viewvc?rev=642603&view=rev | Log: | AXIS2-3679 | Create dispatchableOperations list after both the WSDL-based operations and SEI operations (which includes annotations) have been processed on the client side. | | Modified: | webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/parallelasync/server/AsyncPort.java | webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java | webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java | | Modified: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/parallelasync/server/AsyncPort.java | URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/parallelasync/server/AsyncPort.java?rev=642603&r1=642602&r2=642603&view=diff | ============================================================================== | --- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/parallelasync/server/AsyncPort.java (original) | +++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/parallelasync/server/AsyncPort.java Sat Mar 29 13:41:09 2008 | @@ -264,10 +264,8 @@ | * @return | * returns java.lang.String | */ | -// TODO: This causes validation failures when using the Sun JDK. | -// https://issues.apache.org/jira/browse/AXIS2-3679 | -// @WebMethod(exclude=true) | -// public String customAsync( | -// String request); | + @WebMethod(exclude=true) | + public String customAsync( | + String request); | | } | | Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java | URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java?rev=642603&r1=642602&r2=642603&view=diff | ============================================================================== | --- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java (original) | +++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java Sat Mar 29 13:41:09 2008 | @@ -63,7 +63,7 @@ | private EndpointDescriptionImpl parentEndpointDescription; | private ArrayList<OperationDescription> operationDescriptions = | new ArrayList<OperationDescription>(); | - private Map<QName, List<OperationDescription>> dispatchableOperations = new HashMap<QName, List<OperationDescription>>(); | + private Map<QName, List<OperationDescription>> dispatchableOperations; | private DescriptionBuilderComposite dbc; | | //Logging setup | @@ -96,19 +96,15 @@ | public static final javax.jws.soap.SOAPBinding.ParameterStyle SOAPBinding_ParameterStyle_DEFAULT = | javax.jws.soap.SOAPBinding.ParameterStyle.WRAPPED; | | + /** | + * Add the operationDescription to the list of operations. Note that we can not create the | + * list of dispatchable operations at this points. | + * @see #initializeDispatchableOperationsList() | + * | + * @param operation The operation description to add to this endpoint interface | + */ | void addOperation(OperationDescription operation) { | operationDescriptions.add(operation); | - // Don't put JAXWS client async methods OR excluded methods into the | - // dispatchable operations list. | - if (!operation.isJAXWSAsyncClientMethod() | - && !operation.isExcluded()) { | - List<OperationDescription> operations = dispatchableOperations.get(operation.getName()); | - if(operations == null) { | - operations = new ArrayList<OperationDescription>(); | - dispatchableOperations.put(operation.getName(), operations); | - } | - operations.add(operation); | - } | } | | /** | @@ -495,6 +491,14 @@ | public OperationDescription[] getDispatchableOperation(QName operationQName) { | //FIXME:OperationDescriptionImpl creates operation qname with empty namespace. Thus using localname | //to read dispachable operation. | + // REVIEW: Can this be synced at a more granular level? Can't sync on dispatchableOperations because | + // it may be null, but also the initialization must finish before next thread sees | + // dispatachableOperations != null | + synchronized(this) { | + if (dispatchableOperations == null) { | + initializeDispatchableOperationsList(); | + } | + } | QName key = new QName("",operationQName.getLocalPart()); | List<OperationDescription> operations = dispatchableOperations.get(key); | if(operations!=null){ | @@ -507,6 +511,11 @@ | */ | public OperationDescription[] getDispatchableOperations() { | OperationDescription[] returnOperations = null; | + | + if (dispatchableOperations == null) { | + initializeDispatchableOperationsList(); | + } | + | Collection<List<OperationDescription>> dispatchableValues = dispatchableOperations.values(); | Iterator<List<OperationDescription>> iteratorValues = dispatchableValues.iterator(); | ArrayList<OperationDescription> allDispatchableOperations = new ArrayList<OperationDescription>(); | @@ -518,6 +527,34 @@ | returnOperations = allDispatchableOperations.toArray(new OperationDescription[allDispatchableOperations.size()]); | } | return returnOperations; | + } | + | + /** | + * Create the list of dispatchable operations from the list of all the operations. A | + * dispatchable operation is one that can be invoked on the endpoint, so it DOES NOT include: | + * - JAXWS Client Async methods | + * - Methods that have been excluded via WebMethod.exclude annotation | + * | + * Note: We have to create the list of dispatchable operations in a lazy way; we can't | + * create it as the operations are added via addOperations() because on the client | + * that list is built in two parts; first using AxisOperations from the WSDL, which will | + * not have any annotation information (such as WebMethod.exclude). That list will then | + * be updated with SEI information, which is the point annotation information becomes | + * available. | + */ | + private void initializeDispatchableOperationsList() { | + dispatchableOperations = new HashMap<QName, List<OperationDescription>>(); | + OperationDescription[] opDescs = getOperations(); | + for (OperationDescription opDesc : opDescs) { | + if (!opDesc.isJAXWSAsyncClientMethod() && !opDesc.isExcluded()) { | + List<OperationDescription> dispatchableOperationsWithName = dispatchableOperations.get(opDesc.getName()); | + if(dispatchableOperationsWithName == null) { | + dispatchableOperationsWithName = new ArrayList<OperationDescription>(); | + dispatchableOperations.put(opDesc.getName(), dispatchableOperationsWithName); | + } | + dispatchableOperationsWithName.add(opDesc); | + } | + } | } | | /** | | Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java | URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java?rev=642603&r1=642602&r2=642603&view=diff | ============================================================================== | --- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java (original) | +++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java Sat Mar 29 13:41:09 2008 | @@ -812,6 +812,17 @@ | // ANNOTATION: WebMethod | // ===================================== | public WebMethod getAnnoWebMethod() { | + if (webMethodAnnotation == null) { | + if (isDBC() && methodComposite != null) { | + webMethodAnnotation = methodComposite.getWebMethodAnnot(); | + } else if (!isDBC() && seiMethod != null) { | + webMethodAnnotation = (WebMethod) getAnnotation(seiMethod, WebMethod.class); | + } else { | + if (log.isDebugEnabled()) { | + log.debug("Unable to get WebMethod annotation"); | + } | + } | + } | return webMethodAnnotation; | } | | @@ -1565,11 +1576,9 @@ | // ANNOTATION: OneWay | // =========================================== | public Oneway getAnnoOneway() { | - //TODO: Shouldn't really do it this way...if there is not Oneway annotation, | - // we will always be calling the methods to try to retrieve it, since | - // it will always be null, should consider relying on 'isOneWay' | - | if (onewayAnnotation == null) { | + // Get the onew-way annotation from either the method composite (server-side) | + // or from the SEI method (client-side). | if (isDBC() && methodComposite != null) { | if (methodComposite.isOneWay()) { | onewayAnnotation = OneWayAnnot.createOneWayAnnotImpl(); | | | | --------------------------------------------------------------------- | To unsubscribe, e-mail: [EMAIL PROTECTED] | For additional commands, e-mail: [EMAIL PROTECTED] | -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Cygwin) iD8DBQFH7q/1gNg6eWEDv1kRAlcbAJ9ADbLQbo7PddwgbHbP5V+EqRuQLgCeIsNl 60LJrzl1yyTuKNjpFcnDxMM= =GOa2 -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
