1) Agreed, we'd do that for production
2) Yes, we've used VisualVM to confirm that the heap used is about the
same before and after using our POI-based code. The memory used in
servicing a request for the POI-based code is also about the same as
that used for any other page in our app, so I'm fairly confident that
the URLClassLoader is loading classes and resources on demand.
3) Sadly, yes. Our product is run clustered at lots of customer sites,
so the 60Meg is multiplied many times over. If it was in-house, I'd
absolutely just tweak the JVM config and move on with things.
I've extracted the core bits of what JavaLoader does and I now have a
standalone CFM which uses a URLClassLoader to load our code, create a
JavaProxy and
get an instance of our code and run it, so I know it's workable.
Next I plan on looking at whether I can make the classloader
implementation parameterizable within JavaLoader, as I'd like to add
to it if possible.
I'll report back on how well that works out.
Thanks
Barny
3) Sadly, yes. Our product is run clustered at lots of customer sites,
so the 60Meg is multiplied many times over. If it was in-house, I'd
absolutely just tweak the JVM config and move on with things.
I'm using the latest POI bits (3.8 beta 4 I believe) for "streaming"
xlsx generation, and all it requires is poi and the poi-ooxml jar,
*not* the schemas jar.
Marc
Marc, thanks for the tip, I spoke to the developer who was using POI
and he's done some mild re-factoring and has been able to remove the
dependency on the Schemas jar, which was the bulk of the memory hit
(40meg roughly). Now we just need to do a little testing.
Mark, I took a look about for a child-first classloader and found
quite a number out there. I took the one here:
http://stackoverflow.com/questions/5445511/how-do-i-create-a-parent-last-child-first-classloader-in-java-or-how-to-overri/6424879#6424879
Swapping that in for the NetworkClassLoader (and changing the
construction logic a little) got me the behaviour I was after.
I've made a minor change to JavaLoader to allow making the ClassLoader
it uses a parameter to init(). All I have to do now is supply my own
classloader in a jar in javaloader/lib and specify
classLoaderClass="whatever" when calling init(). I had to modify the
construction code for the ClassLoader a little to cope with the
different ways that NetworkClassLoader and URLClassLoader are
constructed, but it's minor. The only restriction on the new code is
that it only knows how to construct URLClassLoaders or classes that
derive from it, but that seems to be what most Child-First
implementations do.
Here's an example of how I'm now initializing the JavaLoader:
jlArgs=StructNew();
jlArgs.loadPaths = arrJar;
jlArgs.loadColdFusionClassPath=true;
jlArgs.classLoaderClass="com.olmgroup.classloader.YoniChildFirstURLClassLoader";
jl = CreateObject("component","javaloader.JavaLoader").init(argumentCollection=jlArgs);
I'm not sure if the group allows attachments to posts, so I'll try
that in a minute with the updated JavaLoader.
Thanks everyone for your input
Barny
Marc
Sent from my iPad
> <JavaLoader.cfc>