You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by du...@apache.org on 2003/08/02 00:21:57 UTC

cvs commit: xml-axis/java/src/org/apache/axis/providers/java JavaProvider.java

dug         2003/08/01 15:21:57

  Modified:    java/src/org/apache/axis/deployment/wsdd
                        WSDDUndeployment.java
               java/src/org/apache/axis/handlers/soap SOAPService.java
               java/src/org/apache/axis/providers/java JavaProvider.java
  Log:
  http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14807
  Clear sessions when undeploying services
  
  Revision  Changes    Path
  1.14      +12 -0     xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDUndeployment.java
  
  Index: WSDDUndeployment.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDUndeployment.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- WSDDUndeployment.java	22 Apr 2003 19:34:17 -0000	1.13
  +++ WSDDUndeployment.java	1 Aug 2003 22:21:57 -0000	1.14
  @@ -56,6 +56,8 @@
   
   import org.apache.axis.ConfigurationException;
   import org.apache.axis.encoding.SerializationContext;
  +import org.apache.axis.handlers.soap.SOAPService;
  +import org.apache.axis.MessageContext;
   import org.apache.axis.utils.Messages;
   import org.w3c.dom.Element;
   import org.xml.sax.helpers.AttributesImpl;
  @@ -198,6 +200,16 @@
   
           for (int n = 0; n < services.size(); n++) {
               qname = (QName)services.get(n);
  + 
  +            try {
  +              String sname = qname.getLocalPart();
  +              SOAPService service = MessageContext.getCurrentContext()
  +                                                  .getAxisEngine()
  +                                                  .getService(sname);
  +              if ( service != null ) service.clearSessions();
  +            } catch(Exception exp) {
  +              throw new ConfigurationException(exp);
  +            }
               registry.undeployService(qname);
           }
       }
  
  
  
  1.102     +32 -0     xml-axis/java/src/org/apache/axis/handlers/soap/SOAPService.java
  
  Index: SOAPService.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/handlers/soap/SOAPService.java,v
  retrieving revision 1.101
  retrieving revision 1.102
  diff -u -r1.101 -r1.102
  --- SOAPService.java	22 Jul 2003 19:28:13 -0000	1.101
  +++ SOAPService.java	1 Aug 2003 22:21:57 -0000	1.102
  @@ -74,6 +74,7 @@
   import org.apache.axis.message.SOAPFault;
   import org.apache.axis.message.SOAPHeaderElement;
   import org.apache.axis.providers.BasicProvider;
  +import org.apache.axis.session.Session;
   import org.apache.axis.soap.SOAPConstants;
   import org.apache.axis.utils.LockableHashtable;
   import org.apache.axis.utils.Messages;
  @@ -90,6 +91,7 @@
   import java.util.ArrayList;
   import java.util.Enumeration;
   import java.util.Hashtable;
  +import java.util.Iterator;
   import java.util.Vector;
   
   /** A <code>SOAPService</code> is a Handler which encapsulates a SOAP
  @@ -132,6 +134,36 @@
        */
       private ServiceDesc serviceDescription = new ServiceDesc();
       private AxisEngine engine;
  +
  +    /**
  +     * List of sessions (for all services), key=serviceName, value=Service
  +     */
  +    static private Hashtable sessions = new Hashtable();
  +
  +    /** 
  +     * Add this passed in Session to this Service's list of sessions
  +     */
  +    public void addSession(Session session) {
  +      Vector v = (Vector) sessions.get( this.getName() );
  +      if ( v == null )  {
  +        v = new Vector();
  +        sessions.put( this.getName(), v);
  +      }
  +      if ( !v.contains(session) ) v.add(session);
  +    }
  +
  +    /** 
  +     * Remove all of this Service's serviceObjects from it known sessions
  +     */
  +    public void clearSessions() {
  +      Vector v = (Vector) sessions.get( this.getName() );
  +      if ( v == null ) return ;
  +      Iterator iter = v.iterator();
  +      while ( iter.hasNext() ) {
  +        Session session = (Session) iter.next();
  +        session.remove( this.getName() );
  +      }
  +    }
   
       /**
        * Actor list - these are just the service-specific ones
  
  
  
  1.103     +2 -0      xml-axis/java/src/org/apache/axis/providers/java/JavaProvider.java
  
  Index: JavaProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/providers/java/JavaProvider.java,v
  retrieving revision 1.102
  retrieving revision 1.103
  diff -u -r1.102 -r1.103
  --- JavaProvider.java	22 Jul 2003 15:34:09 -0000	1.102
  +++ JavaProvider.java	1 Aug 2003 22:21:57 -0000	1.103
  @@ -209,6 +209,7 @@
                   obj = new LockObject();
                   makeNewObject = true;
                   session.set(serviceName, obj);
  +                msgContext.getService().addSession(session);
               }
           }
   
  @@ -226,6 +227,7 @@
                   try {
                     obj = getNewServiceObject(msgContext, clsName);
                     session.set(serviceName, obj);
  +                  msgContext.getService().addSession(session);
                   } finally {
                     lock.complete();
                   }