snichol     2002/07/11 08:45:54

  Modified:    java/src/org/apache/soap/server/http ServerHTTPUtils.java
               java/docs changes.html
  Log:
  Remove deadlock for a service that in the constructor invokes
  another service when both services are at application scope.  The
  deadlock still occurs if both services are at session scope.
  
  Based on a technique submitted by Adam Moore ([EMAIL PROTECTED]).
  
  Revision  Changes    Path
  1.24      +18 -5     
xml-soap/java/src/org/apache/soap/server/http/ServerHTTPUtils.java
  
  Index: ServerHTTPUtils.java
  ===================================================================
  RCS file: 
/home/cvs/xml-soap/java/src/org/apache/soap/server/http/ServerHTTPUtils.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- ServerHTTPUtils.java      25 Jun 2002 05:16:27 -0000      1.23
  +++ ServerHTTPUtils.java      11 Jul 2002 15:45:53 -0000      1.24
  @@ -246,7 +246,20 @@
       } else if (scope == DeploymentDescriptor.SCOPE_SESSION) {
         scopeLock = session;
       } else if (scope == DeploymentDescriptor.SCOPE_APPLICATION) {
  -      scopeLock = context;
  +      try {
  +        scopeLock = ctxt.loadClass(className);
  +      } catch (ClassNotFoundException e) {
  +        String msg;
  +        if (providerType == DeploymentDescriptor.PROVIDER_JAVA ||
  +            providerType == DeploymentDescriptor.PROVIDER_USER_DEFINED) {
  +          msg = "Unable to resolve target object at application scope: " + 
e.getMessage ();
  +        } else {
  +          msg = "Unable to load BSF at application scope: script services not 
available " +
  +            "without BSF: " + e.getMessage ();
  +        }
  +        throw new SOAPException (
  +          Constants.FAULT_CODE_SERVER_BAD_TARGET_OBJECT_URI, msg, e);
  +      }
       } else {
         throw new SOAPException (Constants.FAULT_CODE_SERVER,
                                  "Service uses deprecated object scope " +
  @@ -264,10 +277,10 @@
         // locate (or create) the target object and invoke the method
         if ( scopeLock == null ) scopeLock = className ; // Just pick something
         synchronized (scopeLock) {
  -        if (scopeLock == session) {
  +        if (scope == DeploymentDescriptor.SCOPE_SESSION) {
             // targetObject = session.getAttribute (targetID);
             targetObject = session.getValue (targetID);
  -        } else if (scopeLock == context) {
  +        } else if (scope == DeploymentDescriptor.SCOPE_APPLICATION) {
             targetObject = context.getAttribute (targetID);
           } else {
             targetObject = null;
  @@ -295,10 +308,10 @@
               // remember the created instance if the scope is not REQUEST;
               // in that case the object is to be thrown away after handling
               // the request
  -            if (scopeLock == session) {
  +            if (scope == DeploymentDescriptor.SCOPE_SESSION) {
                 session.putValue (targetID, targetObject);
                 // session.setAttribute (targetID, targetObject);
  -            } else if (scopeLock == context) {
  +            } else if (scope == DeploymentDescriptor.SCOPE_APPLICATION) {
                 context.setAttribute (targetID, targetObject);
               }
             } catch (Exception e) {
  
  
  
  1.32      +3 -0      xml-soap/java/docs/changes.html
  
  Index: changes.html
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/docs/changes.html,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- changes.html      28 Jun 2002 03:07:35 -0000      1.31
  +++ changes.html      11 Jul 2002 15:45:54 -0000      1.32
  @@ -46,6 +46,9 @@
         multi-reference serialization is supported.  Added a sample to
         demonstrate serialization and deserialization of a cyclic graph
         of beans.</li>
  +      <li>Remove deadlock for a service that in the constructor invokes
  +      another service when both services are at application scope.  The
  +      deadlock still occurs if both services are at session scope.</li>
       </ul>
     </li>
   </ul>
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to