-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question about connections and sessions reuse #808
Comments
Hi, I have similar issue and questions in a multithreaded env with a single client. Moreover I wonder how the two SessionTable in Connection object are used, if, apparently, to retrieve a Session from a Connection, authenticate method is the only public way to do it and it does not reuse open sessions of the Connection. Thanks |
My question is related to the ones above. How can I share a connection/session between unrelated classes? I cannot change existing "interfaces" (in terms of constructors/setters) but I can do some further implementation building the SMB client and get (if possible) an existing session. The default solution is establishing a brand new share connection... Thanks for the great job and thanks for answering |
I'd suggest reading up on design patterns. There's multiple options, depending on what you like:
Each has its benefits and downsides with regard to correct management of connections etc. |
Hi, I don't understand the approach suggested to resolve the initial request. Establishing a shared connection, does not mean getting existing sessions from it, sessions are not reusable objects of the same connection. This seems to be the problem, and authentication to obtain a new session costs. Session pool management would be a great feature to incapsulate into the client itself. The fact is that someting like that exists into the client as a structure (sessionTable) but it is not clear how to use the public interface of the client properly to reusing sessions of the connection in that table or in general. |
Hi, I have a multi thread application with a single instance of SMBJ client. For every operation (download, upload, list, etc.) the program calls
the problem is that i see that the library reuse correctly the connection from the cache but not the session.
for example, if it calls 20 operations after these operations I will always have only one connection object (which it retrieves from the cache each time) while the sessionTable will be populated by 20 sessions (but I would expect only one)
So my question are:
is correct my approach to call every time the "connection.authenticate(authContext)"?if yes, why it doesn't reuse allways the same session but creates every time a new one?
if i don't close manually the connection and the session, they remain alive forever?exists a timeout?and how to set it? (the timeout in SmbConfig seems to be a different thing)
The text was updated successfully, but these errors were encountered: