[jcifs] Persistent Session
Michael B Allen
ioplex at gmail.com
Mon May 11 15:24:41 GMT 2009
On Mon, May 11, 2009 at 8:56 AM, <john.dunlap at exceter.com> wrote:
> I have a Tomcat server which connects to a windows file server to
> upload/download documents. I'm using JCIFS to do this. What I have been
> noticing is that it takes 2-3 seconds to establish the connection, after
> which point the transfer is very fast. Transfers with immediately follow
> the first are also fast. After a little while the session times out and the
> next request again takes 2-3 seconds to go through. As my application
> doesn't have a lot of traffic this essentially means that every request
> will take 2-3 seconds. So, I have two questions,
> 1) Should it take 2-3 seconds to establish a connection or do I have a
> configuration problem?
No there should not be a delay. I would suspect a name service
configuration issue but if that were the case it would take more like
6 seconds. But try setting jcifs.resolveOrder=DNS anyway.
Otherwise, it could just be something JCIFS depends on is slow like
DNS or the file server.
> 2) If the answer to number 1 is no, how do I hold the session open
> indefinitely? Individual users do not connect directly to the file server
> so this would only result in a single connection. It has occurred to me
> that I could schedule a job in Spring which queries the server for a
> directory listing every so often but it seems like there should be a better
> way to go about this.
SMB transports are closed after jcifs.smb.client.soTimeout
milliseconds. If you increase the value *a lot* it will keep the
transport open longer.
Michael B Allen
Java Active Directory Integration
More information about the jcifs