Hi Philip,

I do something similar, my User has a db connection in temporary storage.

I close the connection when the session is unbound, this approach works
either when the user logout or when the server close the session.

I do this implementing in the user the
javax.servlet.http.HttpSessionBindingEvent interface

following an extract of my implementation:

****************************************************************************
*************

    /**
     * Este m�todo es implementado si se desea ser notificado cuando el
Usuario
     * ha sido "Unbound" de la sesi�n, esta implementaci�n en particular
     * hace logout y cierra la conexion usada por el Usuario
     *
     * @param event que indica un unbinding de un valor a la sesi�n.
     */
    public void valueUnbound(HttpSessionBindingEvent event)
    {
        try
        {
            // cerrar conexion si existe

            Connection conn = getConnectionForSession();
            if (hasLoggedIn())
            {

                AtuinAuthentication.logout();
            }

            if (conn != null)
            {

                conn.close();
            }
        }
        catch (Exception e)
        {
            //Log.error("OracleUser.valueUnbobund(): " + e.getMessage(), e);
            // Para prevenir que mensajes enviados al "logging system" se
            // pierdan debido a un "shutdown" del contenedor de servlet
            // imprimos el stacktrace a la consola del contenedor.
            ByteArrayOutputStream ostr = new ByteArrayOutputStream();
            e.printStackTrace(new PrintWriter(ostr, true));
            String stackTrace = ostr.toString();
            System.out.println(stackTrace);
        }
    }
****************************************************************************
*************

Hope this help you

----------------------------------------------------------------------------
Edgar Gonz�lez Gonz�lez
VALHALLA Project, s.a.
Chief Technology Officer
Web: www.valhallaproject.com <http://www.valhallaproject.com>
E-mail: [EMAIL PROTECTED]
Phone: +58-212-242.4379 / 6662 / 4055 / 6475
Fax: +58-212-242.6809
"The limits of my language mean the limits of my world."
Ludwig Wittgenstein
----------------------------------------------------------------------------



-----Mensaje original-----
De: Philip S. Wachtel [mailto:[EMAIL PROTECTED]
Enviado el: jueves, 10 de julio de 2003 05:12 p.m.
Para: Turbine Users List
Asunto: Clean-up on Logout


Hi there,

I need to do something simple, but I'm still trying to get used to how
things should naturally work in Turbine.  I have an object in temporary
storage (user.setTemp()) that I want to run a method on upon logout.  Where
is the best place to do that?  The object I've stored has a connection
opened and I'd like to run .close() on the object when the user logs out.

Thanks!
Philip


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to