Re: Release COM Objects
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Len, On 11/2/2010 5:05 PM, Len Popp wrote: I would use a ServletContextListener. It gets notified when the webapp is initialized and destroyed. The only problem with this is that you may encounter problems with re-deployment when those COM objects need to be re-established. You'll need to be careful about how you initialize the native library and then perform your setup: if you do it like this: try { System.loadLibrary(); JavaComObject jco = new JavaComObject(); jco.setup(); } ... then you're likely to fail since loadLibrary() can only be called once during the lifetime of the JVM. Instead, you'll have to do something like this: try { System.loadLibrary(); } catch (/* whatever gets thrown on a double-loadLibrary */) { // ignore me } JavaComObject jco = new JavaComObject(); jco.setup(); Often, native wrappers try to perform their own initialization and loadLibrary calls, which may not expect you to use the safer code shown above. Good luck! - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkzRa0MACgkQ9CaO5/Lv0PChmwCgs67YhcuNXLt9+ZIjbkoi3/L5 qOcAoI9EvsHHpmyZ70ZNqRty+cDhjSi9 =mSxe -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Release COM Objects
http://j-integra.intrinsyc.com/support/com/doc/gc/index.html #4 com.linar.jintegra.Cleaner.releaseAll(); Can Tomcat call this method prior to shutting down as a windows service? If so where would I configure this? JSF 1.2 (Sun RI) mojarra-1.2 Tomcat running as a windows service Using CATALINA_BASE: C:\apache-tomcat-6.0.29 Using CATALINA_HOME: C:\apache-tomcat-6.0.29 Using CATALINA_TMPDIR: C:\apache-tomcat-6.0.29\temp Using JRE_HOME:C:\Program Files\Java\jdk1.6.0_20 Using CLASSPATH: C:\apache-tomcat-6.0.29\bin\bootstrap.jar Server version: Apache Tomcat/6.0.29 Server built: July 19 2010 1458 Server number: 6.0.0.29 OS Name:Windows 2003 OS Version: 5.2 Architecture: x86 JVM Version:1.6.0_20-b02 JVM Vendor: Sun Microsystems Inc. Leo Donahue
Re: Release COM Objects
Ideally - you would do this as a servlet filter and configured as part of the webapp. So when the filter is destroyed - it unregisters the object. -Tim On 11/2/2010 2:53 PM, Leo Donahue - PLANDEVX wrote: http://j-integra.intrinsyc.com/support/com/doc/gc/index.html #4 com.linar.jintegra.Cleaner.releaseAll(); Can Tomcat call this method prior to shutting down as a windows service? If so where would I configure this? JSF 1.2 (Sun RI) mojarra-1.2 Tomcat running as a windows service Using CATALINA_BASE: C:\apache-tomcat-6.0.29 Using CATALINA_HOME: C:\apache-tomcat-6.0.29 Using CATALINA_TMPDIR: C:\apache-tomcat-6.0.29\temp Using JRE_HOME:C:\Program Files\Java\jdk1.6.0_20 Using CLASSPATH: C:\apache-tomcat-6.0.29\bin\bootstrap.jar Server version: Apache Tomcat/6.0.29 Server built: July 19 2010 1458 Server number: 6.0.0.29 OS Name:Windows 2003 OS Version: 5.2 Architecture: x86 JVM Version:1.6.0_20-b02 JVM Vendor: Sun Microsystems Inc. Leo Donahue - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Release COM Objects
I would use a ServletContextListener. It gets notified when the webapp is initialized and destroyed. -- Len On Tue, Nov 2, 2010 at 14:53, Leo Donahue - PLANDEVX leodona...@mail.maricopa.gov wrote: http://j-integra.intrinsyc.com/support/com/doc/gc/index.html #4 com.linar.jintegra.Cleaner.releaseAll(); Can Tomcat call this method prior to shutting down as a windows service? If so where would I configure this? JSF 1.2 (Sun RI) mojarra-1.2 Tomcat running as a windows service Using CATALINA_BASE: C:\apache-tomcat-6.0.29 Using CATALINA_HOME: C:\apache-tomcat-6.0.29 Using CATALINA_TMPDIR: C:\apache-tomcat-6.0.29\temp Using JRE_HOME: C:\Program Files\Java\jdk1.6.0_20 Using CLASSPATH: C:\apache-tomcat-6.0.29\bin\bootstrap.jar Server version: Apache Tomcat/6.0.29 Server built: July 19 2010 1458 Server number: 6.0.0.29 OS Name: Windows 2003 OS Version: 5.2 Architecture: x86 JVM Version: 1.6.0_20-b02 JVM Vendor: Sun Microsystems Inc. Leo Donahue - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Release COM Objects
-Original Message- From: Len Popp [mailto:len.p...@gmail.com] Subject: Re: Release COM Objects I would use a ServletContextListener. It gets notified when the webapp is initialized and destroyed. -- Len Filter vs ServletContextListener. When does Tomcat tell me in the logs that I might have a memory leak due to some threads not being released upon shutdown? In a Filter or in a ServletContextListener? SRV.9.12 When a web app is deployed, it does the following steps in order... • Instantiate an instance of each event listener identified by a listener element in the deployment descriptor. • For instantiated listener instances that implement ServletContextListener, call the contextInitialized() method. • Instantiate an instance of each filter identified by a filter element in the deployment descriptor and call each filter instance’s init() method. • Instantiate an instance of each servlet identified by a servlet element that includes a load-on-startup element in the order defined by the load-onstartup element values, and call each servlet instance’s init() method. When a web app is shutdown, does it do those same four steps in reverse order? I'm guessing yes according to contextDestroyed() method. (..All servlets and filters have been destroy()ed before any ServletContextListeners are notified of context destruction ...)
Re: Release COM Objects
On 02/11/2010 22:05, Len Popp wrote: I would use a ServletContextListener. It gets notified when the webapp is initialized and destroyed. +1 init happens before servlets shutdown, destroy happens after. p -- Len On Tue, Nov 2, 2010 at 14:53, Leo Donahue - PLANDEVX leodona...@mail.maricopa.gov wrote: http://j-integra.intrinsyc.com/support/com/doc/gc/index.html #4 com.linar.jintegra.Cleaner.releaseAll(); Can Tomcat call this method prior to shutting down as a windows service? If so where would I configure this? JSF 1.2 (Sun RI) mojarra-1.2 Tomcat running as a windows service Using CATALINA_BASE: C:\apache-tomcat-6.0.29 Using CATALINA_HOME: C:\apache-tomcat-6.0.29 Using CATALINA_TMPDIR: C:\apache-tomcat-6.0.29\temp Using JRE_HOME:C:\Program Files\Java\jdk1.6.0_20 Using CLASSPATH: C:\apache-tomcat-6.0.29\bin\bootstrap.jar Server version: Apache Tomcat/6.0.29 Server built: July 19 2010 1458 Server number: 6.0.0.29 OS Name:Windows 2003 OS Version: 5.2 Architecture: x86 JVM Version:1.6.0_20-b02 JVM Vendor: Sun Microsystems Inc. Leo Donahue - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org 0x62590808.asc Description: application/pgp-keys signature.asc Description: OpenPGP digital signature
Re: Release COM Objects
On 02/11/2010 22:23, Leo Donahue - PLANDEVX wrote: -Original Message- From: Len Popp [mailto:len.p...@gmail.com] Subject: Re: Release COM Objects I would use a ServletContextListener. It gets notified when the webapp is initialized and destroyed. -- Len Filter vs ServletContextListener. When does Tomcat tell me in the logs that I might have a memory leak due to some threads not being released upon shutdown? In a Filter or in a ServletContextListener? Neither. When the app is unloaded, after all of the other processes have (or claimed to have) finished. p SRV.9.12 When a web app is deployed, it does the following steps in order... • Instantiate an instance of each event listener identified by a listener element in the deployment descriptor. • For instantiated listener instances that implement ServletContextListener, call the contextInitialized() method. • Instantiate an instance of each filter identified by a filter element in the deployment descriptor and call each filter instance’s init() method. • Instantiate an instance of each servlet identified by a servlet element that includes a load-on-startup element in the order defined by the load-onstartup element values, and call each servlet instance’s init() method. When a web app is shutdown, does it do those same four steps in reverse order? I'm guessing yes according to contextDestroyed() method. (..All servlets and filters have been destroy()ed before any ServletContextListeners are notified of context destruction ...) 0x62590808.asc Description: application/pgp-keys signature.asc Description: OpenPGP digital signature