tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Release COM Objects
Date Wed, 03 Nov 2010 14:01:40 GMT
-----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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message