HI,
  I am using Blueprint extender to inject my services. Everything is ok in
my system. While stopping a KARAF container, none of the deactivate
methods/destroy-method of blueprint is called. We are trying to remove some
entries from a file/remove a file during the karaf shutdown.
Can anyone please let me know how to properly clean up the things during
the karaf shutdown
I tried with deactivate methods, destroy-method(in blueprint) and
SynchronousBundleListener. Nothing works out.

I Went through the forum and found some  of the links  which says blueprint
extender stop immediately and didn't wait for the bundle events.
http://karaf.922171.n3.nabble.com/RFC-on-proposal-to-allow-hooks-into-Karaf-shutdown-td4026953.html
http://karaf.922171.n3.nabble.com/Karaf-shutdown-td4048646.html

*Karaf version: 4.1.4*
*Blueprint version used in karaf : aries-blueprint 4.1.4*
*Stacktrace:*
    2020-10-30T17:41:16.208+0100 | INFO  | Karaf Shutdown Socket Thread
| o.a.k.m.ShutdownSocketThread     | .karaf.main.ShutdownSocketThread  111
|  -  -  | Karaf shutdown socket: received shutdown command. Stopping
framework...
2020-10-30T17:41:16.211+0100 | DEBUG | Framework stop                   |
o.a.a.b.c.BlueprintExtender      | rint.container.BlueprintExtender  169 |
20 - org.apache.aries.blueprint.core - 1.8.3 | Stopping blueprint
extender...
2020-10-30T17:41:16.215+0100 | DEBUG | Framework stop                   |
o.a.a.b.core                     | ogback.internal.FrameworkHandler  171 |
20 - org.apache.aries.blueprint.core - 1.8.3 | ServiceEvent UNREGISTERING -
{org.apache.aries.blueprint.services.ParserService}={service.id=41,
service.bundleid=20, service.scope=singleton} -
org.apache.aries.blueprint.core
2020-10-30T17:41:16.218+0100 | DEBUG | Framework stop                   |
o.a.a.b.core                     | ogback.internal.FrameworkHandler  171 |
20 - org.apache.aries.blueprint.core - 1.8.3 | ServiceEvent UNREGISTERING -
{org.apache.aries.blueprint.services.BlueprintExtenderService}={service.id=42,
service.bundleid=20, service.scope=singleton} -
org.apache.aries.blueprint.core
2020-10-30T17:41:16.219+0100 | DEBUG | Framework stop                   |
o.a.a.b.c.BlueprintExtender      | rint.container.BlueprintExtender  464 |
20 - org.apache.aries.blueprint.core - 1.8.3 | Usage for bundle
org.apache.aries.blueprint.cm/1.1.0 is 9
2020-10-30T17:41:16.219+0100 | DEBUG | Framework stop                   |
o.a.a.b.c.BlueprintExtender      | rint.container.BlueprintExtender  464 |
20 - org.apache.aries.blueprint.core - 1.8.3 | Usage for bundle
org.apache.karaf.shell.core/4.1.4 is 9
2020-10-30T17:41:16.219+0100 | DEBUG | Framework stop                   |
o.a.a.b.c.BlueprintExtender      | rint.container.BlueprintExtender  464 |
20 - org.apache.aries.blueprint.core - 1.8.3 | Usage for bundle
com.java.test.pack.packager.event.ingestion/1.0.0 is 7
2020-10-30T17:41:16.219+0100 | DEBUG | Framework stop                   |
o.a.a.b.c.BlueprintExtender      | rint.container.BlueprintExtender  464 |
20 - org.apache.aries.blueprint.core - 1.8.3 | Usage for bundle
org.apache.aries.blueprint.core/1.8.3 is 17
2020-10-30T17:41:16.219+0100 | DEBUG | Framework stop                   |
o.a.a.b.c.BlueprintExtender      | rint.container.BlueprintExtender  464 |
20 - org.apache.aries.blueprint.core - 1.8.3 | Usage for bundle
org.apache.karaf.jaas.blueprint.config/4.1.4 is 5
2020-10-30T17:41:16.219+0100 | DEBUG | Framework stop                   |
o.a.a.b.c.BlueprintExtender      | rint.container.BlueprintExtender  464 |
20 - org.apache.aries.blueprint.core - 1.8.3 | Usage for bundle
org.apache.camel.camel-blueprint/2.25.0 is 4
2020-10-30T17:41:16.219+0100 | DEBUG | Framework stop                   |
o.a.a.b.c.BlueprintExtender      | rint.container.BlueprintExtender  487 |
20 - org.apache.aries.blueprint.core - 1.8.3 | Currently selecting bundle
org.apache.aries.blueprint.cm/1.1.0 for destroy (with reference
{org.apache.aries.blueprint.NamespaceHandler}={osgi.service.blueprint.namespace=
http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.2.0, service.id=62,
osgi.service.blueprint.compname=CmNamespaceHandler, service.bundleid=19,
service.scope=bundle})
2020-10-30T17:41:16.219+0100 | DEBUG | Framework stop                   |
o.a.a.b.c.BlueprintExtender      | rint.container.BlueprintExtender  487 |
20 - org.apache.aries.blueprint.core - 1.8.3 | Currently selecting bundle
org.apache.aries.blueprint.cm/1.1.0 for destroy (with reference
{org.apache.aries.blueprint.NamespaceHandler}={osgi.service.blueprint.namespace=
http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0, service.id=63,
osgi.service.blueprint.compname=CmNamespaceHandler, service.bundleid=19,
service.scope=bundle})
2020-10-30T17:41:16.220+0100 | DEBUG | Framework stop                   |
o.a.a.b.c.BlueprintExtender      | rint.container.BlueprintExtender  487 |
20 - org.apache.aries.blueprint.core - 1.8.3 | Currently selecting bundle
org.apache.aries.blueprint.cm/1.1.0 for destroy (with reference
{org.apache.aries.blueprint.NamespaceHandler}={osgi.service.blueprint.namespace=
http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0, service.id=64,
osgi.service.blueprint.compname=CmNamespaceHandler, service.bundleid=19,
service.scope=bundle})
2020-10-30T17:41:16.220+0100 | DEBUG | Framework stop                   |
o.a.a.b.c.BlueprintExtender      | rint.container.BlueprintExtender  487 |
20 - org.apache.aries.blueprint.core - 1.8.3 | Currently selecting bundle
org.apache.aries.blueprint.cm/1.1.0 for destroy (with reference
{org.apache.aries.blueprint.NamespaceHandler}={osgi.service.blueprint.namespace=
http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.3.0, service.id=65,
osgi.service.blueprint.compname=CmNamespaceHandler, service.bundleid=19,
service.scope=bundle})
2020-10-30T17:41:16.220+0100 | DEBUG | Framework stop                   |
o.a.a.b.c.BlueprintExtender      | rint.container.BlueprintExtender  487 |
20 - org.apache.aries.blueprint.core - 1.8.3 | Currently selecting bundle
org.apache.aries.blueprint.cm/1.1.0 for destroy (with reference
{org.osgi.service.blueprint.container.BlueprintContainer}={osgi.blueprint.container.version=1.1.0,
service.id=66, service.bundleid=19, service.scope=singleton,
osgi.blueprint.container.symbolicname=org.apache.aries.blueprint.cm})
2020-10-30T17:41:16.220+0100 | DEBUG | Framework stop                   |
o.a.a.b.c.BlueprintExtender      | rint.container.BlueprintExtender  487 |
20 - org.apache.aries.blueprint.core - 1.8.3 | Currently selecting bundle
org.apache.karaf.shell.core/4.1.4 for destroy (with reference
{org.osgi.service.cm.ConfigurationListener}={service.id=131,
service.bundleid=60, service.scope=singleton})
2020-10-30T17:41:16.220+0100 | DEBUG | Framework stop                   |
o.a.a.b.c.BlueprintExtender      | rint.container.BlueprintExtender  487 |
20 - org.apache.aries.blueprint.core - 1.8.3 | Currently selecting bundle
org.apache.karaf.shell.core/4.1.4 for destroy (with reference
{org.apache.karaf.shell.api.console.SessionFactory}={service.id=132,
service.bundleid=60, service.scope=singleton})
2020-10-30T17:41:16.220+0100 | DEBUG | Framework stop                   |
o.a.a.b.c.BlueprintExtender      | rint.container.BlueprintExtender  487 |
20 - org.apache.aries.blueprint.core - 1.8.3 | Currently selecting bundle
org.apache.karaf.shell.core/4.1.4 for destroy (with reference
{org.apache.aries.blueprint.NamespaceHandler}={osgi.service.blueprint.namespace=
http://karaf.apache.org/xmlns/shell/v1.0.0, service.id=135,
osgi.service.blueprint.compname=namespaceHandler, service.bundleid=60,
service.scope=bundle})
2020-10-30T17:41:16.220+0100 | DEBUG | Framework stop                   |
o.a.a.b.c.BlueprintExtender      | rint.container.BlueprintExtender  487 |
20 - org.apache.aries.blueprint.core - 1.8.3 | Currently selecting bundle
org.apache.karaf.shell.core/4.1.4 for destroy (with reference
{org.apache.aries.blueprint.NamespaceHandler}={osgi.service.blueprint.namespace=
http://karaf.apache.org/xmlns/shell/v1.1.0, service.id=136,
osgi.service.blueprint.compname=namespaceHandler, service.bundleid=60,
service.scope=bundle})
2020-10-30T17:41:16.220+0100 | DEBUG | Framework stop                   |
o.a.a.b.c.BlueprintExtender      | rint.container.BlueprintExtender  487 |
20 - org.apache.aries.blueprint.core - 1.8.3 | Currently selecting bundle
org.apache.karaf.shell.core/4.1.4 for destroy (with reference
{org.osgi.service.blueprint.container.BlueprintContainer}={osgi.blueprint.container.version=4.1.4,
service.id=137, service.bundleid=60, service.scope=singleton,
osgi.blueprint.container.symbolicname=org.apache.karaf.shell.core})
2020-10-30T17:41:16.220+0100 | DEBUG | Framework stop                   |
o.a.a.b.c.BlueprintExtender      | rint.container.BlueprintExtender  487 |
20 - org.apache.aries.blueprint.core - 1.8.3 | Currently selecting bundle
com.java.test.pack.packager.event.ingestion/1.0.0 for destroy (with
reference {org.apache.karaf.bundle.core.BundleStateService}={service.id=348,
service.bundleid=267, service.scope=singleton})
2020-10-30T17:41:16.220+0100 | DEBUG | Framework stop                   |
o.a.a.b.c.BlueprintExtender      | rint.container.BlueprintExtender  487 |
20 - org.apache.aries.blueprint.core - 1.8.3 | Currently selecting bundle
com.java.test.pack.packager.event.ingestion/1.0.0 for destroy (with
reference {org.osgi.service.blueprint.container.BlueprintListener}={
service.id=349, service.bundleid=267, service.scope=singleton})
2020-10-30T17:41:16.220+0100 | DEBUG | Framework stop
          ueprintExtender  487 | 20 - org.apache.aries.blueprint.core -
1.8.3 | Currently selecting bundle
com.java.test.pack.packager.event.ingestion/1.0.0 for destroy (with
reference {org.apache.camel.CamelContext}={service.id=355,
service.bundleid=267, service.scope=singleton,
camel.context.managementname=com.java.test.pack.packager.event.ingestion-camelcontext-0,
camel.context.name=camelcontext-0,
camel.context.symbolicname=com.java.test.pack.packager.event.ingestion,
camel.context.version=1.0.0})
2020-10-30T17:41:16.221+0100 | DEBUG | Framework stop                   |
o.a.a.b.c.BlueprintExtender      | rint.container.BlueprintExtender  496 |
20 - org.apache.aries.blueprint.core - 1.8.3 | Selected bundles
[com.java.test.pack.packager.event.ingestion/1.0.0] for destroy (lowest
ranking service)
2020-10-30T17:41:16.221+0100 | DEBUG | Framework stop                   |
o.a.a.b.c.BlueprintExtender      | rint.container.BlueprintExtender  315 |
20 - org.apache.aries.blueprint.core - 1.8.3 | Starting BlueprintContainer
destruction process for bundle
com.java.test.pack.packager.event.ingestion/1.0.0
2020-10-30T17:41:16.221+0100 | DEBUG | Framework stop                   |
o.a.a.b.c.BlueprintExtender      | rint.container.BlueprintExtender  320 |
20 - org.apache.aries.blueprint.core - 1.8.3 | Scheduling
BlueprintContainer destruction for
com.java.test.pack.packager.event.ingestion/1.0.0.
2020-10-30T17:41:16.222+0100 | DEBUG | Framework stop                   |
o.a.a.b.c.BlueprintExtender      | rint.container.BlueprintExtender  345 |
20 - org.apache.aries.blueprint.core - 1.8.3 | Waiting for
BlueprintContainer destruction for
com.java.test.pack.packager.event.ingestion/1.0.0.
2020-10-30T17:41:16.222+0100 | INFO  | Framework stop                   |
o.a.a.b.c.BlueprintExtender      | nt.container.BlueprintExtender$3  323 |
20 - org.apache.aries.blueprint.core - 1.8.3 | Destroying
BlueprintContainer for bundle
com.java.test.pack.packager.event.ingestion/1.0.0
2020-10-30T17:41:16.222+0100 | DEBUG | Framework stop                   |
a.a.b.c.BlueprintEventDispatcher | ntainer.BlueprintEventDispatcher  136 |
20 - org.apache.aries.blueprint.core - 1.8.3 | Sending blueprint container
event BlueprintEvent[type=DESTROYING] for bundle
com.java.test.pack.packager.event.ingestion/1.0.0
2020-10-30T17:41:16.222+0100 | DEBUG | Blueprint Event Dispatcher: 1    |
.k.b.s.b.i.BlueprintStateService | t.internal.BlueprintStateService  103 |
34 - org.apache.karaf.bundle.blueprintstate - 4.1.4 | Blueprint app state
changed to Stopping for bundle 267
2020-10-30T17:41:16.223+0100 | DEBUG | Blueprint Event Dispatcher: 1    |
o.a.c.b.BlueprintCamelContext    | .blueprint.BlueprintCamelContext  181 |
352 - org.apache.camel.camel-blueprint - 2.25.0 | Received
BlueprintEvent[replay=false type=DESTROYING
bundle=com.java.test.pack.packager.event.ingestion] %s
2020-10-30T17:41:16.231+0100 | DEBUG | Framework stop

Thanks,
Shriram.

Reply via email to