Java 使用SpringDM扩展器
我需要等待一段时间才能关闭我的OSGI上下文(给一些时间来完成当前正在运行的任务)。我在Java 使用SpringDM扩展器,java,spring,eclipse-virgo,spring-dm,osgi-fragment,Java,Spring,Eclipse Virgo,Spring Dm,Osgi Fragment,我需要等待一段时间才能关闭我的OSGI上下文(给一些时间来完成当前正在运行的任务)。我在extenderPropertiesbean中遇到了shutdown.wait.time属性 有人能告诉我如何使用这个OSGi片段来实现我的目标吗?我想我可以将一个片段包附加到我现有的OSGI包上 提前谢谢。感谢您的帮助。您需要创建一个包含两个文件的捆绑包:META-INF/MANIFEST.MF和META-INF/spring/extender/extender.xml(xml文件可以命名为任何具有xml扩
extenderProperties
bean中遇到了shutdown.wait.time
属性
有人能告诉我如何使用这个OSGi片段来实现我的目标吗?我想我可以将一个片段包附加到我现有的OSGI包上
提前谢谢。感谢您的帮助。您需要创建一个包含两个文件的捆绑包:META-INF/MANIFEST.MF和META-INF/spring/extender/extender.xml(xml文件可以命名为任何具有xml扩展名的文件,但必须位于META-INF/spring/extender文件夹中)。您的MANIFEST.MF文件需要包含org.springframework.OSGi.extender的OSGi MANIFEST头Fragment Host。如果您使用的是maven bundle插件,那么您的插件配置如下所示:
...
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.5</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Fragment-Host>org.springframework.osgi.extender</Fragment-Host>
</instructions>
</configuration>
</plugin>
...
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
<util:properties id="extenderProperties">
<prop key="shutdown.wait.time">30000</prop>
</util:properties>
</beans>
。。。
org.apache.felix
maven捆绑插件
2.3.5
真的
org.springframework.osgi.extender
...
您的extender.xml文件将需要定义一个名为extenderProperties的java.util.Propertiesbean。它应该包含一个名为shutdown.wait.time的属性,该属性的值以毫秒为单位(例如30000表示30秒)。该文件可能如下所示:
...
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.5</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Fragment-Host>org.springframework.osgi.extender</Fragment-Host>
</instructions>
</configuration>
</plugin>
...
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
<util:properties id="extenderProperties">
<prop key="shutdown.wait.time">30000</prop>
</util:properties>
</beans>
30000
然后将包部署到您的环境中。您可能需要重新启动Spring OSGi捆绑包(或您的服务器),具体取决于此片段捆绑包相对于Spring DM捆绑包的安装顺序。您需要创建一个包含两个文件的捆绑包:META-INF/MANIFEST.MF和META-INF/Spring/extender/extender.xml(xml文件可以命名为任何具有xml扩展名的文件,但必须位于META-INF/spring/extender文件夹中)。您的MANIFEST.MF文件将需要包含org.springframework.OSGi.extender的OSGi MANIFEST头片段主机
...
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.5</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Fragment-Host>org.springframework.osgi.extender</Fragment-Host>
</instructions>
</configuration>
</plugin>
...
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
<util:properties id="extenderProperties">
<prop key="shutdown.wait.time">30000</prop>
</util:properties>
</beans>
。。。
org.apache.felix
maven捆绑插件
2.3.5
真的
org.springframework.osgi.extender
...
您的extender.xml文件将需要定义一个名为extenderProperties的java.util.Propertiesbean。它应该包含一个名为shutdown.wait.time的属性,其值以毫秒为单位(例如30000,持续30秒)。该文件可能如下所示:
...
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.5</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Fragment-Host>org.springframework.osgi.extender</Fragment-Host>
</instructions>
</configuration>
</plugin>
...
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
<util:properties id="extenderProperties">
<prop key="shutdown.wait.time">30000</prop>
</util:properties>
</beans>
30000
然后将捆绑包部署到您的环境中。您可能需要重新启动Spring OSGi捆绑包(或您的服务器),具体取决于此片段捆绑包相对于Spring DM捆绑包的安装顺序