关于插件卸载后plugin文件下扔保留插件文件的解释

But why aren't uninstalled bundles/features immediately removed?
p2 does not immediately remove bundles on uninstall for several reasons:

Minimizing waste: By retaining the bundles, p2 can save time and bandwidth to should these bundles be re-installed.
For safety: Many bundles do not properly support hot-swapping and removal. Writing bundles that can be uninstalled completely is surprisingly difficult, and even harder to test.
In practice the timing of deletion should not matter as p2 ensures that the bundles will not be re-installed (modulo the org.eclipse.update.configurator issue described elsewhere in this FAQ).

p2 does periodically perform a garbage collection of uninstalled features and bundles, typically after having performed another uninstall. See elsewhere in this FAQ for details on how to explicitly request a garbage collect.

Why aren't bundles being removed when their associated feature has been removed?
There are two aspects to this problem.

First, you should ensure that features are recorded when installing a feature by specifying the "org.eclipse.update.install.features=true" property, such that the bundles have a recorded dependency against the feature. This property is not the default, so if you are using the p2 director manually it is worth verifying.

Second, you must invoke the p2 garbage collector.[1] By default, p2 only performs a garbage collect at its discretion. Normally this is fine since the actual bundles to be loaded are still known and managed (either in the config.ini file or by the simpleconfigurator).

You can cause a garbage collect in one of 3 ways:

Configure your product to invoke a GC on startup by adding the following line to your product's plugin_customization.ini (requires the org.eclipse.equinox.p2.ui.sdk.scheduler bundle):
org.eclipse.equinox.p2.ui.sdk.scheduler/gcOnStartup=true
Run the garbage collector application:[2]
eclipse -application org.eclipse.equinox.p2.garbagecollector.application -profile SDKProfile
Explicitly invoke the p2 garbage collection from code:
IProvisioningAgentProvider provider = // obtain the IProvisioningAgentProvider using OSGi services
IProvisioningAgent agent = provider.createAgent(null); // null = location for running system
if(agent == null) throw new RuntimeException("Location was not provisioned by p2");
IProfileRegistry profileRegistry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
if (profileRegistry == null) throw new RuntimeException("Unable to acquire the profile registry service.");
// can also use IProfileRegistry.SELF for the current profile
IProfile profile = profileRegistry.getProfile("SDKProfile");
GarbageCollector gc = (GarbageCollector) agent.getService(GarbageCollector.SERVICE_NAME);
gc.runGC(profile);

转自:https://wiki.eclipse.org/Equinox/p2/FAQ#cite_note-2
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值