The org.zkoss.zk.ui.event.EventThreadCleanup Interface

As emphasized before, it is important to close the connection in the finally clause, such that every connection will be returned to connection pool correctly.

To make your application more robust, you could implement the org.zkoss.zk.ui.event.EventThreadCleanup interface to close any pending connections and statements, in case that some of your application codes might forget to close them in the finally clause.

However, how to close pending connection and statements really depend on the server you are using. You have to consult the document of the server for how to write one.

Tip: In many cases, it is not necessary (and not easy) to provide such method, because most implementation of connection pooling be recycled a connection if its finalized method is called.