Hi Ben,

Your "educated guess" proved to be entirely correct!

I added the below method to my RegistryProxy class, and calling it from the @OnMessage annotated method of the WebSocket server endpoint ensures Hibernate sessions get closed on completion and associated DB connections are released back to the pool. This was the only little glitch encountered in getting Tapestry working hand-in-hand with the WebSocket API, and I'm glad to have it sorted.

I appreciate your pointers which certainly saved me much time.


    /**
* Method to manually instruct registry to clean up thread, as Tapestry services acquired not via dependency * injection fall outside the usual thread lifecycle. Without this, Hibernate sessions will not close when a
     * WebSocket session is closed resulting in leaked DB connections.
     */
    public static void cleanupThread(){
Registry registry = (Registry)context.getAttribute(TapestryFilter.REGISTRY_CONTEXT_NAME);
        registry.cleanupThread();
    }


Kind regards,

Chris.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to