> Does Tomcat release all the resources used by an object if the object
> has been stored in the session context and a call to
> session.removeAttribute("objName") is made? I'd like to blow away
> several beans that are used throughout the processing of a transaction
> once the confirmation page is called.
Calling session.invalidate() should do it for you. It will unbind all objects bound to
it, as well as closing the session itself.
> At this stage the only two ways I can think of doing this is to call
> session.removeAttribute(...) or retrieve the object from the session
> context and then assigning null to it, i.e. myObj = (MyObj)
> session.getAttribute("myObjName"); myObj = null;.
The second way will do nothing. session.getAttribute() will give you a reference to an
object (which is bound by the session - that is, a reference to it is held in the
session) and then you will loose that reference. The object will still live in the
session.
Nix.