A. Mark Mandel is working on a pluggable cache for Transfer with the
default being EHCache. I've been playing around with it and stumbled
onto a problem where every time I "reinit" my coldbox app, a new
instance of EHCache is created. If I "reinit" often enough, I run out
of memory.
Mark has found the cause and it appears that EHCache has to be stopped
when the application stops. He's still working on the implementation
but I wanted to bring it up here as the built in Colbox Transfer
support will likely have to call whatever "shutdown" implementation
Mark uses when an app is reinit to prevent the memory problems I
experienced.
Just wanted to bring it up now for what I presume will become the
future version of Transfer.
"I'll expose the EHCacheManager through the CacheMonitor (which is the
last
thing on the Monitor I need to do), but I'm wondering if it makes more
sense
to have a TransferFactory.shutdown() method as a general method, which
calls
similarly on the CacheProvider, that needs to be called
onApplicationEnd...
or if it's worth simply doing this by a cache by cache basis through
the
CacheMonitor."
The implementation Mark chose was "TransferFactory.shutdown()".
Is this currently possible: On reinit, hook into the existing cache,
check if Transfer is in there, call shutdown() on it, and proceed
with reiniting?
I'm still experimenting with different interception points but it
appears that, on reinit, a new cache is created and so the transfer
object in the old cache is gone leaving me a ehcache instance forever.
A. Fantastic! It's working great. The ehcache manager threads are
"shutdown" once my interceptor checks if the TransferFactory is in the
coldbox cache, gets it if yes, and runs shutdown() on it on the two
new interception points.
B. Small bug though. In the advanced application template (no
inheritance), the "onApplicationEnd" function makes a reference to the
"Application" scope which I don't think exists at that point. I had to
changed it to reference the argument that is passed in and then it
worked.