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 #244: Adds support for reserving service id
Date Tue, 09 Jun 2020 20:11:07 GMT

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

File path: libs/framework/include/celix_bundle_context.h
@@ -126,8 +126,38 @@ typedef struct celix_service_registration_options {
      * for this.
     const char *serviceVersion OPTS_INIT;
+    /**
+     * If set to > 0, this svc id will be used to register the service.
+     * The reservedSvcId should be reserved with a call to celix_bundleContext_reserveSvcId
+     */
+    long reservedSvcId OPTS_INIT;
 } celix_service_registration_options_t;
+ * Reserves a service id, which is expected to be used to register a service in the future.
+ *
+ * If a celix_bundleContext_unregisterService with the reserved service id is called earlier
+ * the celix_bundleContext_registerServiceWithOptions with the reserved service, the registration
will be be cancelled.
+ * This means then when the expected celix_bundleContext_registerServiceWithOptions call
happens this will not
+ * result in a service registration and a  -2 will be returned as service id.
+ *
+ * Subsequent calls to celix_bundleContext_registerServiceWithOptions for an already cancelled
service id will
+ * return a -1 error code (and a 'Invalid reservedSvcId' error log entry will be logged).

Review comment:
       no,  Registering with a reserved id which is unknown gives a -1. Whether this is due
to using an already cancelled reserved service id or "just" a invalid reserved service id
is not tracked.
   So the bundle context keeps track of reserved service ids for future service registrations
(to follow through with the registration or when cancelled skip the registration), but after
that they are not tracked any more. 

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