Author: kostat
Date: 2007-05-15 09:30:29 -0400 (Tue, 15 May 2007)
New Revision: 77401

Modified:
   trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/BaseHttpServlet.cs
   trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.SessionState/SessionListener.cs
Log:
remove derby anti leak workarounds which proved to be buggy

Modified: trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/BaseHttpServlet.cs
===================================================================
--- trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/BaseHttpServlet.cs        
2007-05-15 13:26:56 UTC (rev 77400)
+++ trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/BaseHttpServlet.cs        
2007-05-15 13:30:29 UTC (rev 77401)
@@ -51,8 +51,6 @@
                static readonly LocalDataStoreSlot _servletSlot = 
Thread.GetNamedDataSlot(J2EEConsts.CURRENT_SERVLET);
 
                bool _appVirDirInited = false;
-               Field _derbyContextService;
-               java.lang.ThreadLocal _derbyLocal;
 
                public BaseHttpServlet()
                {
@@ -65,55 +63,6 @@
                        
                }
 
-               void InitDerby () {
-                       try {
-                               java.lang.ClassLoader loader = 
vmw.common.TypeUtils.ToClass (this).getClassLoader ();
-                               java.lang.Class derbyContextService = 
loader.loadClass ("org.apache.derby.iapi.services.context.ContextService");
-                               if (derbyContextService.getClassLoader () == 
loader)
-                                       _derbyContextService = 
derbyContextService.getDeclaredField ("factory");
-                       }
-                       catch {
-                               _derbyContextService = null;
-                       }
-               }
-
-               internal void CleanupDerby () {
-                       if (_derbyContextService == null)
-                               return;
-                       try {
-
-                               if (_derbyLocal == null) {
-                                       _derbyContextService.setAccessible 
(true);
-                                       object contextServiceFact = 
_derbyContextService.get (null);
-                                       if (contextServiceFact == null)
-                                               return;
-
-                                       Field derbyLocalField = 
vmw.common.TypeUtils.ToClass (contextServiceFact).getDeclaredField 
("threadContextList");
-                                       if (derbyLocalField == null) {
-                                               _derbyContextService = null;
-                                               return;
-                                       }
-
-                                       derbyLocalField.setAccessible (true);
-                                       object derbyLocal = derbyLocalField.get 
(contextServiceFact);
-                                       if (derbyLocal == null || !(derbyLocal 
is java.lang.ThreadLocal)) {
-                                               _derbyContextService = null;
-                                               return;
-                                       }
-                                       _derbyLocal = (java.lang.ThreadLocal) 
derbyLocal;
-                               }
-
-
-                               _derbyLocal.set (null);
-                       }
-                       catch (Exception e) {
-#if DEBUG
-                               Console.WriteLine (e.ToString ());
-                               _derbyContextService = null;
-#endif
-                       }
-               }
-
                protected virtual void InitServlet(ServletConfig config)
                {
                        if 
(config.getServletContext().getAttribute(J2EEConsts.APP_DOMAIN) != null)
@@ -135,7 +84,6 @@
                                
servletDomain.SetData(J2EEConsts.SERVLET_CONFIG, config);
                                
servletDomain.SetData(J2EEConsts.RESOURCE_LOADER, new [EMAIL 
PROTECTED](config.getServletContext()));
 
-                               InitDerby ();
                                
config.getServletContext().setAttribute(J2EEConsts.APP_DOMAIN, servletDomain);
                                config.getServletContext ().setAttribute 
(J2EEConsts.CURRENT_SERVLET, this);
                        }
@@ -215,7 +163,6 @@
                                Thread.SetData(_servletResponseSlot, null);
                                Thread.SetData(_servletSlot, null);
                                [EMAIL PROTECTED]();
-                               CleanupDerby ();
                        }
                }
 
@@ -247,22 +194,6 @@
                        finally
                        {
                                [EMAIL PROTECTED]();
-                               CleanupDerby ();
-                               if (_derbyContextService != null) {
-                                       try {
-                                               URL u = 
vmw.common.TypeUtils.ToClass (this).getClassLoader ().getResource 
("org/apache/derby/iapi/services/context/ContextService.class");
-                                               if (u != null) {
-                                                       URLConnection con = 
u.openConnection ();
-                                                       if (con is 
JarURLConnection)
-                                                               
((JarURLConnection) con).getJarFile ().close ();
-                                               }
-                                       }
-                                       catch (Exception ex) {
-#if DEBUG
-                                               Console.WriteLine (ex.ToString 
());
-#endif
-                                       }
-                               }
                        }
                }
 

Modified: 
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.SessionState/SessionListener.cs
===================================================================
--- trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.SessionState/SessionListener.cs   
2007-05-15 13:26:56 UTC (rev 77400)
+++ trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.SessionState/SessionListener.cs   
2007-05-15 13:30:29 UTC (rev 77401)
@@ -63,9 +63,6 @@
                        finally {
                                if (setDomain) {
                                        [EMAIL PROTECTED] ();
-                                       BaseHttpServlet servlet = 
(BaseHttpServlet) se.getSession ().getServletContext ().getAttribute 
(J2EEConsts.CURRENT_SERVLET);
-                                       if (servlet != null)
-                                               servlet.CleanupDerby ();
                                }
                        }
                }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to