UniVerse database UniSession instance - can it be used by multiple threads concurrently?

StackOverflow https://stackoverflow.com/questions/10564044

  •  08-06-2021
  •  | 
  •  

سؤال

The UODOTNET documentation does not explicitly say that a session instance can be used by multiple threads, but it says this "As we expect UniObjects for .NET to be used in a multithreaded environment,...".

I would just like some confirmation that this actually DOES mean that I can have two SELECTs on the same UniSession instance active at the same time.

I imagine that if it does indeed work like this then it means the SELECTs would have to reference different select lists. Is that correct?

هل كانت مفيدة؟

المحلول

UniObjects does not support using the same session for multiple parallel actions. Essentially, using the same session for parallel actions is like trying to do two things at once at TCL. When I tried two long running selects on different threads I received the following error:

Unable to read data from the transport connection: A blocking operation was interrupted by a call to WSACancelBlockingCall.[IBM U2][UODOTNET - UNIRPC][ErrorCode=81009] The RPC failed

UniObjects does support parallel threads using different sessions though. Because they are different sessions, the select lists wouldn't conflict unless you're using saved ones.

If you're worried about licensing, you could utilize phantoms to perform these parallel actions. Phantoms allow basic programs to be run asynchronously. It is my understanding that phantoms only consume a license under certain cases (EX: performing HTTP requests). Your single threaded .NET application could call a basic process twice that creates a phantom each time to run your select and save the result to some arbitrary location. We use the following PICK basic code to run an arbitrary basic program "PHANTOM.TEST" with a phantom:

EXECUTE "PHANTOM PHANTOM.TEST ":RECORDID

I try to avoid phantoms because I have yet to find an elegant way to determine that a phantom has finished running.

Phantom licensing reference: https://u2tc.rocketsoftware.com/documentation/PDF/1177927.pdf

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top