We can create multiple client instances, running ServerOperations.Login() after setting the client LoginOptions for each one. When we do, running ServerOperations.GetWorkingFolderAssignments() only returns folders corresponding to the first login session. I guess our second call to ServerOperations.Login() is really doing nothing and we really only have one login session/client instance.
Is there a way for us to use ServerOperations().GetWorkingFolderAssignments() and the various ServerOperations.ProcessCommandXXXX methods for multiple client instances? Would saving and restoring the current client instance with ServerOperations.client.get_ClientInstance() and ServerOperations.set_ClientInstance() work?
Eric
Multiple client instances
Moderator: SourceGear
Re: Multiple client instances
Yes, I think that if you always switch your clientinstances before you do things, you should be fine. Also, make sure that no two clientInstances are doing anything at once.
Subscribe to the Fortress/Vault blog
Re: Multiple client instances
Jeremy,
Thanks, I was able to get this to work. This is what I had to do:
final ClientInstance ci = new ClientInstance();
ci.Init(VaultConnection.AccessLevelType.Client);
ServerOperations.client.set_ClientInstance(ci);
VaultLib.Brander.getInstance().setMode(connection.isFortressMode() ? Brander.Mode.FortressMode : Brander.Mode.VaultMode);
//set ServerOperations.client.LoginOptions here
ServerOperations.Login();
//save ServerOperations.client.get_ClientInstance() for later use with set_ClientInstance()
//note that this is not the ClientInstance constructed and set above, ServerOperations.Login() creates a new one
Eric
Thanks, I was able to get this to work. This is what I had to do:
final ClientInstance ci = new ClientInstance();
ci.Init(VaultConnection.AccessLevelType.Client);
ServerOperations.client.set_ClientInstance(ci);
VaultLib.Brander.getInstance().setMode(connection.isFortressMode() ? Brander.Mode.FortressMode : Brander.Mode.VaultMode);
//set ServerOperations.client.LoginOptions here
ServerOperations.Login();
//save ServerOperations.client.get_ClientInstance() for later use with set_ClientInstance()
//note that this is not the ClientInstance constructed and set above, ServerOperations.Login() creates a new one
Eric
Re: Multiple client instances
Thanks for the update Eric. Let me know if you need anything else.
Subscribe to the Fortress/Vault blog