celix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [celix] abroekhuis commented on a change in pull request #244: Adds support for reserving service id
Date Thu, 04 Jun 2020 08:52:33 GMT

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



##########
File path: libs/framework/include/celix_bundle_context.h
##########
@@ -126,8 +126,34 @@ 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
than
+ * the celix_bundleContext_registerServiceWithOptions with the reserved service. The registering
+ * of the service will be cancelled instead.

Review comment:
       What happens on subsequent calls to register? It is always and forever cancelled? If
so, how to reclaim a svc Id?

##########
File path: libs/framework/include/celix_bundle_context.h
##########
@@ -47,7 +47,7 @@ extern "C" {
 * @param svc the service object. Normally a pointer to a service struct (i.e. a struct with
function pointers)
 * @param serviceName the service name, cannot be NULL
 * @param properties The meta properties associated with the service. The service registration
will take ownership of the properties (i.e. no destroy needed)
-* @return The serviceId (>= 0) or < 0 if the registration was unsuccessful.
+* @return The serviceId (>= 0), -1 if the registration was unsuccessful and -2 if the
registration was cancel (only possible when using opts.reservedServiceId.

Review comment:
       The last part isn't clear to me. Can you elaborate it a bit?




----------------------------------------------------------------
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:
users@infra.apache.org



Mime
View raw message