You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2005/11/22 17:41:25 UTC
svn commit: r348194 -
/webservices/axis/trunk/java/src/org/apache/axis/handlers/soap/SOAPService.java
Author: dims
Date: Tue Nov 22 08:41:22 2005
New Revision: 348194
URL: http://svn.apache.org/viewcvs?rev=348194&view=rev
Log:
Fix for AXIS-2314 - Axis leaking Session objects
from Ben Gunter
Modified:
webservices/axis/trunk/java/src/org/apache/axis/handlers/soap/SOAPService.java
Modified: webservices/axis/trunk/java/src/org/apache/axis/handlers/soap/SOAPService.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/src/org/apache/axis/handlers/soap/SOAPService.java?rev=348194&r1=348193&r2=348194&view=diff
==============================================================================
--- webservices/axis/trunk/java/src/org/apache/axis/handlers/soap/SOAPService.java (original)
+++ webservices/axis/trunk/java/src/org/apache/axis/handlers/soap/SOAPService.java Tue Nov 22 08:41:22 2005
@@ -56,6 +56,7 @@
import java.util.Map;
import java.util.HashMap;
import java.util.List;
+import java.util.WeakHashMap;
/** A <code>SOAPService</code> is a Handler which encapsulates a SOAP
* invocation. It has an request chain, an response chain, and a pivot-point,
@@ -116,21 +117,21 @@
* 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);
+ WeakHashMap map = (WeakHashMap) sessions.get( this.getName() );
+ if ( map == null ) {
+ map = new WeakHashMap();
+ sessions.put( this.getName(), map);
}
- if ( !v.contains(session) ) v.add(session);
+ if ( !map.containsKey(session) ) map.put(session, null);
}
/**
* 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();
+ WeakHashMap map = (WeakHashMap) sessions.get( this.getName() );
+ if ( map == null ) return ;
+ Iterator iter = map.keySet().iterator();
while ( iter.hasNext() ) {
Session session = (Session) iter.next();
session.remove( this.getName() );