Search code examples
javamultithreadingsmbjcifs

Using jCIFS in multiple threads


I am using jCIFS (SMB) to access network drives from a java desktop application. I notice that the first access takes around 6 seconds but, following that, there is very little delay.

However, when I connect to a network path on a new thread, the 6 second delay on first access is present again.

I assume that the delay is due to the initial authentication and that a session token (or something similar) is stored in the current thread.

Is there a way to share the session between more than one thread?


Solution

  • I found this post JCIFS: file retrieval is too slow to be usable.

    Using the setting, jcifs.Config.setProperty("jcifs.resolveOrder", "DNS");, made the connect faster and resolved my problem.