Problem

Can I call getComponent and releaseComponent multiple times? How would the calls be handled?

Solution

The ACS Manager keeps one single reference per each client/component.

Therefore calling getComponent from the same client/component multiple times does not increase the reference count. The Manager recognizes that the request comes from the same client/component from the identifier and simply returns the same component reference. The Java ZLegacy/ACS.ContainerServices do not even forward such redundant calls to the manager, but instead return the existing component reference.

As a consequence one call to releaseComponent will release the component independently from the number of times getComponent has been called.

If the client's code has to be such that multiple calls to getComponent/releaseComponent can take place and we want to avoid releasing the component unexpectedly, then the developer should implement the singleton pattern for the reference and hide getComponent/releaseComponent inside that.

Wh have discussed the possibility of implementing support classes in ACS to access components in this way and we have it in our "remaining list", but we have not implemented them yet.