sure, the reason I was asking is that I've also been thinking about this and got stuck pretty quickly.
it's no biggie to add an explicit method to do this: we're used to writing init() functions, so writing a finalise() (not "finaliZe") should be no biggie... but you'd have to remember to call it (and, apart from closing a file or something what would you use it for? I can't think of anything else...) but (in the case of sessions timing out or a CFC instance being garbage collected) what's really needed is the component being self aware of it's impending doom. I wonder if it's possible to tap into the underlying java? but would you have to re-write the java class loaders so you can override the java.lang.Object's finalize()? my head hurts... ------------------------------------- protected void finalize() throws Throwable {} * every class inherits the finalize() method from java.lang.Object * the method is called by the garbage collector when it determines no more references to the object exist * the Object finalize method performs no actions but it may be overridden by any class ------------------------------------- On 5/1/07, Aaron DC <[EMAIL PROTECTED]> wrote:
Option 3: I want to run (not necessarily clean up) code when the object is (about to be) destroyed. I am pretty sure I read that the code inside a CFC but outside any functions gets run at CFC creation time. I was just curious if a similar mechanism existed for CFC destruction time. The CFC could be cached in session, request or application scope, was hoping for something scope agnostic, and it's more of a "the programmer wants to play" than a "the programmer needs this for his job" type scenario. Thanks Aaron Barry Beattie wrote: > Arron, > > are you asking because of memory considerations > > or > > do you want to run some clean-up code? > > > > On 4/30/07, Phillip Senn <[EMAIL PROTECTED]> wrote: >> Short answer: no. >> Long answer: I can think of two things: >> 1. Wrap what you want to do in a begin/end Custom Tag. >> 2. Depending on the scope of your cfc, you could use the onRequestEnd, >> onSessionEnd, etc. >> >> >> -----Original Message----- >> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Aaron DC >> Sent: Monday, April 30, 2007 7:40 AM >> To: cfcdev@cfczone.org >> Subject: [CFCDEV] CFC Constructor >> >> Is there a concept similar to a destructor built in to CFMX CFCs? >> >> Thanks >> Aaron >> >> >> You are subscribed to cfcdev. To unsubscribe, please follow the >> instructions at http://www.cfczone.org/listserv.cfm >> >> CFCDev is supported by: >> Katapult Media, Inc. >> We are cool code geeks looking for fun projects to rock! >> www.katapultmedia.com >> >> An archive of the CFCDev list is available at >> www.mail-archive.com/cfcdev@cfczone.org >> >> >> >> You are subscribed to cfcdev. To unsubscribe, please follow the >> instructions at http://www.cfczone.org/listserv.cfm >> >> CFCDev is supported by: >> Katapult Media, Inc. >> We are cool code geeks looking for fun projects to rock! >> www.katapultmedia.com >> >> An archive of the CFCDev list is available at >> www.mail-archive.com/cfcdev@cfczone.org >> >> > > > You are subscribed to cfcdev. To unsubscribe, please follow the > instructions at http://www.cfczone.org/listserv.cfm > > CFCDev is supported by: > Katapult Media, Inc. > We are cool code geeks looking for fun projects to rock! > www.katapultmedia.com > > An archive of the CFCDev list is available at > www.mail-archive.com/cfcdev@cfczone.org > > > You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org