编程语言
首页 > 编程语言> > java-Eclipse插件单例设置

java-Eclipse插件单例设置

作者:互联网

我有一个包含自定义Xpath函数的插件,可以由工作区中的所有项目访问.创建插件时,由于需要扩展名和扩展点,因此将其创建为单例.这样做是为了使自定义功能仅被注册一次?

[]此插件为单例

同样在运行时,这是否意味着所有利用定制功能的应用程序都需要等待另一个应用程序才能调用定制功能?如果是这样,这会减慢一切吗?还是他们可以同时调用函数,而插件之间没有等待依赖关系?

解决方法:

所有此标志的作用是确保仅加载单个版本的插件.因此,如果RCP中同时存在插件的1.0.0版和2.0.0版,则只能使用其中之一(通常是最高版本).

它不会以任何方式影响插件的执行方式.

从OSGi规范的“ Bundle-SymbolicName”开始:

singleton – Indicates that the bundle can only have a single version
resolved in an environment. A value of true indicates that the bundle
is a singleton bundle. The default value is false. The Framework must
resolve at most one bundle when multiple versions of a singleton
bundle with the same symbolic name are installed.

标签:eclipse-plugin,java
来源: https://codeday.me/bug/20191118/2030199.html