tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Registering Plugins, e.g. javax.imageio...
Date Wed, 11 Sep 2013 17:43:44 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Konstantin,

On 9/11/13 12:44 PM, Konstantin Kolinko wrote:
> 2013/9/11 Christopher Schultz <chris@christopherschultz.net>:
>> On 9/10/13 6:34 PM, George S. wrote:
>>> 
>>> On 9/10/13 3:14 PM, Christopher Schultz wrote:
>>>> ----- Is there a way that I can specify something in the 
>>>> server.xml code that would register them? The only thing I
>>>> can see is to create a org.apache.catalina.LifecycleListener
>>>> and put the code to register the plugins in there.
>>>> 
>>>> Is there some other way of doing it? How would you do it if
>>>> you weren't running under Tomcat?
>>> 
>>> I only ever run Java with tomcat (or maybe ant), so I wouldn't 
>>> know.
>> 
>> Okay. I had never heard of an "imageio plugin" before. Are you 
>> basically registering file-type handlers?
>> 
>> I'm just guessing at all of this, since I've never done anything 
>> besides use ImageIO for mundane operations like loading, saving,
>> and re-sizing images.
>> 
>> Have you called ImageIO.scanForPlugins()?
>> 
>> The documentation gives light detains on how the plug-ins are
>> found:
>> 
>> http://docs.oracle.com/javase/7/docs/api/javax/imageio/ImageIO.html#scanForPlugins%28%29
>>
>
>> 
> Those docs say that scanning is performed automatically on first
> access.

Aah, yes. I didn't read it very closely :)

> As such, I would really recommend to write a Listener,  so that 
> whatever classes are  found by scanning were loaded by the System 
> classloader and had no references to the Webapp one.

The implications of doing this are that George will need to place the
JAR file(s) containing his plug-ins in Tomcat's lib/ directory, so
they can be picked-up by the top-level ClassLoader.

Using the existing JreMemoryLeakPreventionListener (with appropriate
configuration) might take care of this... I don't exactly know when
ImageIO will actually trigger this scan.

> Having unexpected references to the Webapp classloader would be
> bad, as it leads to PermGen memory leaks.

+1

> The above is just a theoretical recommendation. I do not know how 
> ImageIO manages those classes internally.
> 
> BTW, beware of known issue, mentioned in the FAQ, 
> http://wiki.apache.org/tomcat/FAQ/KnownIssues#ImageIOIssues

+1

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJSMKvOAAoJEBzwKT+lPKRY0g0P/2tTM7Gs8NvoYNUNnCFcr5ZM
e2AE7XfcD3Pp8Te+NTe/8k6gLrjsSC0P8klhpn0WbFkipi73WWFYqjrAoTiZeRG6
C47liEJ3qUxCEcYGk7BIIpYMaRmBvDbKsx6IRQolixIbnBOD7/A/7RjDenMBzedu
mLme921ruqYmTh9IICxwsjNiEbN7mjUf6DmMJnmyqisCBAOCUn7aj8aTLe8MJata
Kuj77Mwn7RipcRjISE9FVyBepcEx9jV1GzzJZtXSVQFffG5CrKm1k1lKROV7bZgr
pDR2EkMe3Pk91MeEJwMIpdImAFwgsfCq0vCq+iwTrvH8ES2T2OD1b+8NX4pwxmMu
C2bkjfWKgRvc2qZiGmwAIEAUecT63Rtwkwl2rTJQnGtlVwx11aGZD8HIJnKpxTIt
naOZo5+A7fCpuUEm+EtOFXehYeSsj4FTavJ0xupUgB/f2rm399e/B0Z/GUp6iVC6
sRxfJ8aGs02x4miQQtVmKMD2SMRmRv57ks6H80luZiDU8EJ3cGB5gFydxeSsJ1br
pu2g4Y2LHgVWtz+51xWOH0OA9DUjIvGCI76nBHF/9vIqQ+63z2Zkk8DcCk8gDhW0
t56grgIlxMJEJo/UAaWZWTWkreMixsEV/1XTrYkt0Iq3q6ravjg4OzBSFOz/w4mc
BdgA9RotiAa8IfM63dLx
=2zyh
-----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