FYI: Possible future problem with CB and built in Transfer support

Hi Luis,

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.

B. From the Transfer mailing list:

http://groups.google.com/group/transfer-dev/browse_thread/thread/19e192eb9cedabed?tvc=2

"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."

Thank you,
Gabriel

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.

Thank you,
Gabriel

I will check on this. I beleive the solution is to fire a new
interceptor when the framework reinits. I will add this and let you
know where

Check the nightly build.

Two new interception points:

applicationEnd - shot by the Application.cfc application end
preReinit - shot by ColdBox before reinitializing.

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

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.

- FROM -

<cfargument name="appScope" type="struct" required="true">
<cfset application.cbBootstrap.onApplicationEnd(argumentCollection=arguments)>

- TO -

<cfargument name="appScope" type="struct" required="true">
<cfset arguments.appScope.cbBootstrap.onApplicationEnd(argumentCollection=arguments)>

- Gabriel

Awesome thanks.