I need to wait some time before shut down my OSGI context.( Give some time to finish the tasks that are currently running). I came across with shutdown.wait.time
property in the extenderProperties
bean.
Can anyone please let me know how can I use this OSGi fragments to achieve my goal? I think I can attach a fragment bundle to my existing OSGI bundle.
Thanks in advance. appreciate your help.
You'll need to create a bundle with two files in it: META-INF/MANIFEST.MF and META-INF/spring/extender/extender.xml (the xml file could be named anything with an xml extension, but must be in the META-INF/spring/extender folder). Your MANIFEST.MF file will need to contain the OSGi manifest header Fragment-Host of org.springframework.osgi.extender. If you're using the maven-bundle-plugin, your plugin configuration would look something like this:
Your extender.xml file will need to define a java.util.Properties bean with a name of extenderProperties. It should contain a property named shutdown.wait.time with a value in milliseconds (eg. 30000 for 30 seconds). The file may look like this:
Then deploy the bundle into your environment. You may need to restart the Spring OSGi bundles (or your server) depending on the order this fragment bundle is installed in relation to the Spring DM bundles.