best practice for CFCDynamicProxy -- one for each proxied type? or one for the entire app?

30 views
Skip to first unread message

Marc Esher

unread,
Jan 18, 2012, 6:34:51 AM1/18/12
to javaloader-dev
All,

I'm creating several different kinds of proxies via CFCDynamicProxy:

CFCDynamicProxy =
application.javaloader.create("com.compoundtheory.coldfusion.cfc.CFCDynamicProxy");

And then using CFCDynamicProxy.createInstance(...);

My question is: is there any reason why I *wouldn't* want to create
that as an app-scoped object, and use that singleton instance to
create all my proxy objects?

Or is it intended to have a 1:1 between the CFCDP object and the
proxied objects being created?

Thanks.

Marc

Mark Mandel

unread,
Jan 18, 2012, 6:44:43 AM1/18/12
to javaloa...@googlegroups.com
I can't think of any reason at all to not have it as a singleton.

AS you can see from the code - createInstance is static, and creates a new instance of the CFCDynamicProxy on each invocation.


Mark


On Wed, Jan 18, 2012 at 10:34 PM, Marc Esher <marc....@gmail.com> wrote:
My question is: is there any reason why I *wouldn't* want to create
that as an app-scoped object, and use that singleton instance to
create all my proxy objects?



Marc Esher

unread,
Jan 18, 2012, 7:06:39 AM1/18/12
to javaloa...@googlegroups.com
Thanks Mark. I looked at the code, and that's why I asked... that
"backupFusionContext" class variable had me worried since it looks
like it could *possibly* be used during proxy invocation.

Mark Mandel

unread,
Jan 18, 2012, 8:22:43 AM1/18/12
to javaloa...@googlegroups.com

Yeah, it's used when we need a context and we're not on a ColdFusion request - so err just use the one from when the proxy was generated.

Mark

Sent from my mobile doohickey.

Marc Esher

unread,
Jan 18, 2012, 9:24:25 AM1/18/12
to javaloa...@googlegroups.com
excellent. thanks!
Reply all
Reply to author
Forward
0 new messages