Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

session bean destructor

843841Jul 22 2005 — edited Jul 22 2005
An application that I am working on has a bean that retains information about files uploaded by the user. The files are temporary, and need to be deleted at the end of the user's session-- hence the bean.

<jsp:useBean id="fileupload" class="changehoursrequest.FileUpload" scope="session" />

I was hoping that all that I would have to do is define a destructor in the bean (protected void finalize()) that deletes the temporary files. The destructor does what it's supposed to do, but doesn't seem to be called when the session ends. Is there a listener that I need to use? Am I doing something else wrong? Any suggestions?

Here's the skelaton of the bean..

public class FileUpload implements Enumeration
{
public FileUpload(HttpServletRequest request) { }
public FileUpload() {}
public MultipartRequest getRequest() {}
public void setRequest(HttpServletRequest request) { }
public String getFileName() {}
public String getFileType() {}
public String getFileSystemName() {}
public String getFileContents() {}
public boolean hasMoreElements() {}
public Object nextElement() {}

// destroy temporary files
protected void finalize() {}
}

thanks,


Bryan
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 19 2005
Added on Jul 22 2005
8 comments
127 views