[jcifs] basic session management question
Caldarale, Charles R
Chuck.Caldarale at unisys.com
Fri May 22 21:59:16 GMT 2009
> From: jcifs-bounces+chuck.caldarale=unisys.com at lists.samba.org
> [mailto:jcifs-bounces+chuck.caldarale=unisys.com at lists.samba.org]
> Subject: [jcifs] basic session management question
> Is it ok to perform the SmbSession.logon in the servlet init or
> a static block and keep the connection open for the life of the
The SMB server on the other end may drop the connection due to idleness, so be prepared to re-establish it as needed. Also, you should close the connection when the webapp is stopped or reloaded (i.e., when Servlet.destroy() is called by the container).
My preference would be in a ServletContextListener rather than a specific servlet, primarily to avoid the clutter. The SmbSession object could be stored as an attribute of ServletContext to make it usable by all servlets of the webapp.
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
More information about the jcifs