Right, okay, i just need to change it to where when I call getMH() it
creates and returns a new object every time. Then the init() really
is what it is.
Thanks guys, I appreciate it.
On 10/25/05, David Ross <[EMAIL PROTECTED]> wrote:
> Ryan,
>
> Your email is rather difficult to follow, but I'll try to answer.
>
> - Your MessageHandler is composed within your DAOs, meaning there is a
> single instance of messageHandler within each (hopefully in the
> variables scope of your DAO).
>
> - Right off the bat, your usage of init() is very confusing. init() is a
> constructor, it should only be called ONE time in the entire lifespan of
> an object. In fact, a paranoid coder would throw an exception if init()
> was called more than once.
>
> -For whatever reason, your DAOs are calling init() each time their
> methods are invoked. This tells me either you need a new instance of
> your MessageHandler for each DAO method invocation, or MessageHandler
> needs to be coded so that it is thread-safe (similar to the way you code
> your DAOs).
>
> The code you posted (" <cfset VAR mh = getMH() /> ") is no different
> than just talking directly to the variables.MessageHandler (or whatever
> you named it). Remember, objects are passed by reference. Thus each
> local var is a reference to the same object instance. Thus your code is
> not thread safe.
>
> Hope that helps!
>
> -Dave
> >>> [EMAIL PROTECTED] 10/25/05 4:58 PM >>>
> Hey guys,
>
> i just had a thought and need to know exactly how this works.
>
> I have a component that I am using in composition in some of my other
> components. I have a messageHandler, which an object is being created
> of in all of my daos. In every method that runs, it inits() or resets
> the object, the method uses the messageHandler methods, it then
> returns the information stored in the message handler. then the next
> method that runs will init() and reset it again and the process
> repeats.
>
> I am createing an object out of the messageHandler in every dao when
> the dao object is created and then the same messageHandler object is
> being reused over and over. I am bringing it into each method like so
> <cfset VAR mh = getMH() /> and getMH() just returns the reference to
> the object.
>
> So my question is this: since i am using VAR inside each of the
> methods, is it really creating it locally? My worry is that it is not
> even still, and so if one method of my dao starts to run, and another
> method starts to run before the first one is completed will the init()
> of the second method clear out the data of the first ones instance?
>
> If so, then the only way I see around this is to create the
> messageHandler object for each method, or put exclusive locks in every
> method. I hope this really isnt the case...
>
> thanks,
> --
> Ryan Guill
> BlueEyesDevelopment
> [EMAIL PROTECTED]
> www.ryanguill.com
> (270) 217.2399
> got google talk? Chat me at [EMAIL PROTECTED]
>
> The Coldfusion Open Application Library - COAL -
> http://coal.ryanguill.com
>
> www.ryanguill.com/
> The Roman Empire: www.ryanguill.com/blog/
>
>
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email to
> [email protected] with the words 'unsubscribe cfcdev' as the subject of
> the email.
>
> CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
> (www.cfxhosting.com).
>
> CFCDev is supported by New Atlanta, makers of BlueDragon
> http://www.newatlanta.com/products/bluedragon/index.cfm
>
> An archive of the CFCDev list is available at
> www.mail-archive.com/[email protected]
>
>
>
>
> -----------------------------------------
> CONFIDENTIALITY NOTICE: This email and any attachments may contain
> confidential information that is protected by law and is for the sole
> use of the individuals or entities to which it is addressed. If you are
> not the intended recipient, please notify the sender by replying to
> this email and destroying all copies of the communication and
> attachments. Further use, disclosure, copying, distribution of, or
> reliance upon the contents of this email and attachments is strictly
> prohibited. To contact Albany Medical Center, or for a copy of our
> privacy practices, please visit us on the Internet at www.amc.edu.
>
>
>
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email to
> [email protected] with the words 'unsubscribe cfcdev' as the subject of the
> email.
>
> CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
> (www.cfxhosting.com).
>
> CFCDev is supported by New Atlanta, makers of BlueDragon
> http://www.newatlanta.com/products/bluedragon/index.cfm
>
> An archive of the CFCDev list is available at
> www.mail-archive.com/[email protected]
>
>
>
--
Ryan Guill
BlueEyesDevelopment
[EMAIL PROTECTED]
www.ryanguill.com
(270) 217.2399
got google talk? Chat me at [EMAIL PROTECTED]
The Coldfusion Open Application Library - COAL - http://coal.ryanguill.com
www.ryanguill.com/
The Roman Empire: www.ryanguill.com/blog/
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
[email protected] with the words 'unsubscribe cfcdev' as the subject of the
email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
(www.cfxhosting.com).
CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]