Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The workspace inter-app communication overshot its goals in some respects. #21

Open
michaelelfial opened this issue Oct 3, 2019 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@michaelelfial
Copy link
Contributor

The local proxies (known also as dummy proxies) enable local API and apps to be used as services hidden behind them. This prevents the clients from easily calling non-interface methods on the service providers (servers). This includes ability to subscribe to server events, receive operations as results and so on. All this also means two-way references - especially when events are exposed by the service interface. For this reason the IManagedInterface and every proxy have the Release() method which destroys the proxy and the references between the two parties kept by it.

To minimize the need to call directly Release way to often we introduced the proxy-container component, carried internally by both LocalAPIClient and AppGate. This enables all the active proxies to be released in a single call to ReleaseAll method supported by both the container and the classes above. Obviously AppGate is auto-released when the app closes, thus freeing all proxies to services the app holds. Under some circumstances AppGate is not convenient or not available (library code, components designed for embedding in other apps and so on.). Using own LocalAPIClient in these cases solves the problem and a container is also available in these cases.

This is all good and we want to keep it that way, but we also optimized the process by preventing the creation of new proxies when one for the same interface and the same server exist in a given container. E.g. When you request a proxy through another (calling a method that returns one) previously obtained through a given LocalAPIClient it will return the same proxy again and again if you happen to request the same service from the same provider/server. Releasing it will release the only such proxy in the container and this can be unexpected.

The above behavior is fine for the overwhelming majority of cases almost fully hiding the non-javascripty need to Release something. However there are scenarios when services are used in large numbers from many servers/providers, but for very short periods of time. This effectively mean their useful lifecycle will very often be the function's body execution. Now the cleanest and way to do something like that will be to create a local LocalAPIClient, get all the services you need , do something and release the whole LocalAPI with its container. It is possible to get individual proxies for individual services, skipping the container, but the procedures needed to do so are obscure and inconvenient.

The idea needed here is how to make such kind of usage possible in a convenient and simple manner that fits well into the normal usage of AppGate and LocalAPIClient. It must remain clearly distinguishable, so that the programmers do not forget to Release the services they request, but they should not use any container and the respective optimizations.

@michaelelfial michaelelfial added the help wanted Extra attention is needed label Oct 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant