Hello Florian,

I have tried to reproduce the problem, but it seems to work well; I have
committed a sample code which reflects the usecase you are describing here
[1].
Can you please clone it and give it a try (the sample code is built using
bndtools 3.4.0).

To build the sample:

git clone https://github.com/pderop/test.dm.factorypid.git
cd test.dm.factorypid
chmod a+x ./gradlew
./gradlew jar
./gradlew export.launch

the last command generates a ubber jar in
test.dm.factorypid/test/generated/distributions/executable/launch.jar

just run it:

cd test.dm.factorypid/test/generated/distributions/executable
java -jar launch.jar

you will see these logs:

Configurator: creating conf
JavacordConnector.configure: property=value
JavacordConnector.start
NOPCommandRegistry.run

now, from gogo, stop the bundle:

g! lb
START LEVEL 1
  ID|State      |Level|Name
   0|Active     |    0|System Bundle (5.6.10)|5.6.10
   1|Active     |    1|test (1.0.0.201807052324)|1.0.0.201807052324
   2|Active     |    1|Apache Felix Configuration Admin Service
(1.8.8)|1.8.8
   3|Active     |    1|Apache Felix Dependency Manager (4.4.1)|4.4.1
   4|Active     |    1|Apache Felix Gogo Command (1.0.2)|1.0.2
   5|Active     |    1|Apache Felix Gogo Runtime (1.0.10)|1.0.10
   6|Active     |    1|Apache Felix Gogo Shell (1.0.0)|1.0.0
   7|Active     |    1|Apache Felix Metatype Service (1.1.2)|1.1.2

stop 1

and you will see this logs:

JavacordConnector.stop

so, I wonder why you are overriding the init/start/stop/destroy callbacks
using :

   setCallbacks(null, "connect", "disconnect", null);

This method is only used when you need to override the lifecycle
init/start/stop/destroy callbacks.
Maybe your component has "start"/"stop" callbacks, not
"connect"/"disconnect" callbacks ?

let me know if the sample works for you, maybe there is another thing I
have missed ?

regards
Pierre

[1] https://github.com/pderop/test.dm.factorypid

On Thu, Jul 5, 2018 at 6:43 PM, Florian Pattke <cap5...@web.de> wrote:

> Hello,
>
> I am using a FactoryConfigurationAdapterServer and I have problems to
> unregister the services, when I stop the bundle.
>
> Here is my activator code:
>
> public void init(BundleContext bundleContext, DependencyManager
> dependencyManager) throws Exception {
>     dependencyManager.add(
>             createFactoryConfigurationAdapterService(
>                     JavacordConnector.SERVICE_PID,
>                     "configure",
>                     true,
>                     JavacordConnectorConfiguration.class
>             )
>             .setImplementation(JavacordConnector.class)
>             .setCallbacks(null, "connect", "disconnect", null)
>             .add(
>                     createServiceDependency()
>                             .setService(CommandRegistry.class)
>                             .setRequired(false)
> .setDefaultImplementation(NOPCommandRegistry.class)
>             )
>     );
> }
>
> Situation:
> - bundle is active
> - factory adapter is registered
> - via config file and ConfigAdmin is a JavacordConnector registered as well
>
> Now when I stop the bundle nothing happens. All services are still
> available, up and running.
> How can achieve that all these services will be stopped, once I stop the
> bundle?
>
> Regards
> Florian
>
> ---
> Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
> https://www.avast.com/antivirus
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
> For additional commands, e-mail: users-h...@felix.apache.org
>
>

Reply via email to