Announcement

Collapse
No announcement yet.

more web questions

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • more web questions

    I don't know if anyone else here uses Tomcat or J2EE much, but does anyone know if there's a reliable way to register a function to be run when a session expires? I have some stuff I want to clean up and don't really want to make a wrapper class just for this purpose.

  • #2
    What kind of stuff are you trying to clean up, exactly?

    Tomcat should close all open connections, and when Java objects leave scope they will get deallocated.
    "The issue is there are still many people out there that use religion as a crutch for bigotry and hate. Like Ben."
    Ben Kenobi: "That means I'm doing something right. "

    Comment


    • #3
      Excel instances.

      Comment


      • #4
        If only someone told you how much of a terrible idea this was.

        I don't know specifically, but my best guess is to implement the cleanup in the finalize() methods of classes. Which is Java's quasi-destructor and gets called when the object is garbage collected.
        "The issue is there are still many people out there that use religion as a crutch for bigotry and hate. Like Ben."
        Ben Kenobi: "That means I'm doing something right. "

        Comment


        • #5
          Yes, I was hoping to avoid writing a wrapper class (which I'd have to do to override finalize()). Ahwell.

          Comment


          • #6
            Wrapper class is undoubtedly the way to do it. Since you're using unsafe objects (that exist outside of the VM) you need to have the wrapper class to control access and ensure proper disposal.

            I had to do the same thing but with C#/.NET and Outlook automation using COM objects. Wrapper objects with an overridden dispose() method to ensure handles are released and no memory is leaked.

            It's not a big deal.
            "The issue is there are still many people out there that use religion as a crutch for bigotry and hate. Like Ben."
            Ben Kenobi: "That means I'm doing something right. "

            Comment

            Working...
            X