IBM Business Automation Community Come for answers. Stay for best practices. All we’re missing is you. Join / Log in Ask a question
I develop an application that works with Content Manager com.ibm.mm.beans classes.
I know from the documentation that it is not possible to share a single CMBConnection instance by multiple threads:
"A single instance of the CMBConnection bean can only be used on a single thread at any point in time." (link)
Hence, the threads in my application use the CMBConnectionPool to get and release connections.
Because of the application design, it would be beneficial to be able to share CMBItems across threads, e.g.:
Even though I'm replacing the CMBItem's connection by the one that's exclusively used by thread-2, I was able to see in a profiler that thread-2 is still blocked by resources owned by thread-1. I concluded then that replacing the CMBItem connection is not enough. Actually, this old support page states exactly that:
"The APIs do not directly support multiple threads using the same connected session and the objects obtained from that connected session." (My emphasis added)
That support page only applies for CM 8.1 and 8.2, though. Is there a way of sharing CMBItem instances across threads in CM 8.5 or 8.6? Is there any other objects apart from CMBConnection that I need to replace in the bean?
Beans does not support this. You can implement it with other solutions, eg:deep copy a CMBItem in thread-2.