Page 1 of 1

Multiple client instances

Posted: Fri Apr 24, 2009 9:59 am
by smartbear
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

Re: Multiple client instances

Posted: Fri Apr 24, 2009 2:28 pm
by jeremy_sg
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.

Re: Multiple client instances

Posted: Fri May 08, 2009 9:29 am
by smartbear
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

Re: Multiple client instances

Posted: Fri May 08, 2009 9:31 am
by jeremy_sg
Thanks for the update Eric. Let me know if you need anything else.