Question

I did not really manage to find proper documentation about this. There are the classes in JCO com.sap.conn.jco.JCoDestination and com.sap.conn.jco.JCoDestinationManager. My questions about them:

  • are they thread safe?
  • if not, are they expensive to create?
Was it helpful?

Solution

I think I have found it finally. http://help.sap.com/saphelp_nwpi711/helpdata/en/48/6437ccbdbc51eee10000000a421937/content.htm

CAUTION In a multi-thread environment, distribution of objects (for example, JCoTable objects) between different threads must be implemented carefully. Note that it is not possible to make multiple concurrent SAP calls for the same direct connection.

So its not thread safe

OTHER TIPS

One cannot say for the whole JCo framework that it would be thread-safe or not. It depends on the used classes and instances.

Data container instances in JCo like JCoFunction, JCoTable, JCoStructure and JCoRecord, are not thread-safe - luckily, because usually they are not accessed from different threads simultaneously, so not automatically synchronizing these instances leads to better performance.

But classes and static methods are thread-safe in JCo. You do not need to synchronize calls to the JCoDestinationManager, for example.

And with JCoDestination it's a special case. Usually you don't need to synchronize your calls to this instance because it will internally create and use distinct RFC client connection objects for each session. In JCo's default implementation every thread is treated as separate session, so you cannot get into trouble with the thread-safety here. Only if the infrastructure environment registers its own SessionReferenceProvider at the JCo runtime and would assign the same session ID to multiple threads at the same time, then there might be thread-safety conflicts for stateful RFC calls to the same destination. In this case JCo detects such an error situation and throws a JCoException with error group JCO_ERROR_CONCURRENT_CALL.

Have you read the documentation of connector?

https://websmp105.sap-ag.de/~sapidb/011000358700000730362009D/SAPJCo_Doku_3.0_EN.pdf

I don't understand your question, you try to call a RFC and you have not achieved?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top