cancel
Showing results for 
Search instead for 
Did you mean: 

NW RFC and multi-threading.

Former Member
0 Kudos

I am currently in the process of migrating a C++ application from using Classic RFC to NW RFC. I have a multi-threading question from Note 513386 and Using Multi Threading - Components of SAP Communication Technology - SAP Library (both about JCo but look relevant) it seems that you cannot execute (call RfcInvoke) for multiple concurrent functions on the same connection. Does this apply just to RfcInvoke or all calls related to a Function (eg, RfcCreateFunction, RfcDestroyFunction, ...).

Thanks,

Simon

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

It turns out that the problem was actually with RfcPing, this was being used to check if a connection was still open before re-using it. By replacing this with RfcIsConnectionHandleValid the issue disappears and while its not guaranteed that the connection is still open, its better than nothing with the added bonus of being less expensive than RfcPing.

Answers (1)

Answers (1)

former_member188883
Active Contributor
0 Kudos

Hi Simon,

As per information in SAP note 513386

The recommended procedure for multithreaded applications is, however, not to share any JCO.Client instances via several threads at all, but rather to use an individual instance for each thread.The JCo client pooling mechanism offers a special service here, as you can use it to fetch a client from the pool as required, use it for your function call and then return it to the pool.Multithreading and synchronization problems do not then even arise

This has impact on Rfcinvoke process only. Once the RFC connection is invoked, we can execute relevant function modules and then release the connection.

Hope this helps.

Regards,

Deepak Kori

Former Member
0 Kudos

Given that I don't use JCo is this basically saying that each thread should have its own connection?

former_member188883
Active Contributor
0 Kudos

Hi Simon,

I have the understanding that each thread will have its own connection.

Regards,

Deepak Kori