celix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [celix] pnoltes commented on a change in pull request #316: Initial executor abstraction to promise
Date Tue, 02 Feb 2021 10:01:57 GMT

pnoltes commented on a change in pull request #316:
URL: https://github.com/apache/celix/pull/316#discussion_r568472456

File path: misc/experimental/promise/README.md
@@ -96,25 +84,18 @@ void processPayload(celix::Promise<std::shared_ptr<RestApi::Payload>>
promise) {
-## Open Issues & TODOs
-### Circular References in the execution model
+## Differences with OSGi Promises & Java
-There is a issue with circular references of shared_ptr between the executor and
-SharedPromiseState. SharedPromiseState has a shared_ptr to the executor to delegate 
-execution of chains (onResolve, onSuccess, etc) and the executor accept 
-SharedPromiseState - in the form of tasks - to really execute those chains. 
-This will lead to the situation where the process exists, but the destructor of 
-the executor any some SharedPromiseState are not called leading to mem leaks.
-<b>TODO Discuss</b>: One way to solve this is that the SharedPromiseState has
a weak_ptr to the 
-executor and only delegates chain execution if the executor still exists. 
-If the executor is gone the chains will not be executor resulting into a error situation.

+1. There is no singleton default executor. A PromiseFactory can be construction argument-less
to create a default executor, but this executor is then bound to the lifecycle of the PromiseFactory.
If celix::IExecutor is injected in the PromiseFactory, it is up to user to control the complete
lifecycle of the executor (e.g. by providing this in e ThreadExecutionModel bundle and ensuring
this is started early (and as result stopped late).

Review comment:

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:

View raw message