예제 #1
0
        public static void DestroyRuntime(ServletContext context, IJDBCDriverDeregisterer evidence)
        {
            AppDomain servletDomain = (AppDomain)context.getAttribute(J2EEConsts.APP_DOMAIN);

            if (servletDomain == null)
            {
                return;
            }

            try {
                [email protected](servletDomain);
                Debug.WriteLine("Destroy of GhHttpServlet");
                HttpRuntime.Close();
                [email protected](evidence);
                context.removeAttribute(J2EEConsts.APP_DOMAIN);
                try {
                    FactoryFinder.releaseFactories();
                }
                catch (FacesException) { }

                java.lang.ClassLoader appClassLoader = vmw.common.TypeUtils.ToClass(evidence).getClassLoader();

                IJDBCDriverDeregisterer dereg = evidence;

                java.util.Enumeration en = java.sql.DriverManager.getDrivers();
                while (en.hasMoreElements())
                {
                    Object o = en.nextElement();
                    if (vmw.common.TypeUtils.ToClass(o).getClassLoader() == appClassLoader)
                    {
                        dereg.DeregisterDriver((java.sql.Driver)o);
                    }
                }

                java.lang.Thread.currentThread().setContextClassLoader(null);
            }
            catch (Exception e) {
                Debug.WriteLine(String.Format("ERROR in Servlet Destroy {0},{1}", e.GetType(), e.Message));
                Debug.WriteLine(e.StackTrace);
            }
            finally {
                [email protected]();
            }
        }
예제 #2
0
		public static void DestroyRuntime (ServletContext context, IJDBCDriverDeregisterer evidence) {
			AppDomain servletDomain = (AppDomain) context.getAttribute (J2EEConsts.APP_DOMAIN);
			if (servletDomain == null)
				return;

			try {
				[email protected] (servletDomain);
				Debug.WriteLine ("Destroy of GhHttpServlet");
				HttpRuntime.Close ();
				[email protected] (evidence);
				context.removeAttribute (J2EEConsts.APP_DOMAIN);
				try {
					FactoryFinder.releaseFactories ();
				}
				catch (FacesException) { }

				java.lang.ClassLoader appClassLoader = vmw.common.TypeUtils.ToClass (evidence).getClassLoader ();

				IJDBCDriverDeregisterer dereg = evidence;

				java.util.Enumeration en = java.sql.DriverManager.getDrivers ();
				while (en.hasMoreElements ()) {
					Object o = en.nextElement ();
					if (vmw.common.TypeUtils.ToClass (o).getClassLoader () == appClassLoader)
						dereg.DeregisterDriver ((java.sql.Driver) o);
				}

				java.lang.Thread.currentThread ().setContextClassLoader (null);
			}
			catch (Exception e) {
				Debug.WriteLine (String.Format ("ERROR in Servlet Destroy {0},{1}", e.GetType (), e.Message));
				Debug.WriteLine (e.StackTrace);
			}
			finally {
				[email protected] ();
			}
		}