It's even worth. Objects with finalize method overridden have to be garbage collected twice. firstly, when there's no reference pointing to it any more. Secondly, after the finalize method has been called. The mechanism is: 1. gc detects, that there are no more references pointing to the object 2. gc creates a new reference pointing to the object. this is necessary, because the finalize method cannot run in the garbage collector thread 3. gc marks object as beeing scheduled for garbage collection 3. jvm runs the finalize method 4. gc detects again, that there's no more references pointing to the object 5. this time the object is really disposed (memory freed), because the "scheduled for garbage collection" flag is already set this means overriding the finalize methods doubles the work for the garbage collector. holger Quoting Scott M Stark <[EMAIL PROTECTED]>: > Finalizers are poor choices for handling memory sensitive behavior as they > can > interferre with gc and in fact there is no guarentee that they will even be > run. > > -- > xxxxxxxxxxxxxxxxxxxxxxxx > Scott Stark > Chief Technology Officer > JBoss Group, LLC > xxxxxxxxxxxxxxxxxxxxxxxx > > Bill Burke wrote: > > > I'm trying to figure out a fix for a deadlock scenario with the cache, > > passivation, and the OveragerTask. > > > > I was thinking. Why do all this work to see if a ctx can be passivated? > It > > is just error prone. > > > > Couldn't we just let the garbage collector decide when to passivate? > > Implement EnterpriseContext.finalize to > > > > 1. passivate the ctx > > 2. put the object in the pool. > > > > The javadocs for finalize state that it is ok for the finalize method to > do > > stuff like "making this object available again to other threads". So why > > all the hassle? > > > > What are the drawbacks of this? I can't see any right now. > > > > Thanks, > > > > Bill > > > > XXXXXXXXXXXXXXXX > > Bill Burke > > Chief Architect > > JBoss Group, LLC > > XXXXXXXXXXXXXXXX > > > > ------------------------------------------------------- > This SF.net email is sponsored by: VM Ware > With VMware you can run multiple operating systems on a single machine. > WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the > same time. Free trial click here: http://www.vmware.com/wl/offer/345/0 > _______________________________________________ > JBoss-Development mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-development > >
------------------------------------------------- This mail sent through IMP: http://horde.org/imp/ ------------------------------------------------------- This SF.net email is sponsored by: VM Ware With VMware you can run multiple operating systems on a single machine. WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the same time. Free trial click here: http://www.vmware.com/wl/offer/345/0 _______________________________________________ JBoss-Development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
