@Activate
void activate(BundleContext context) {
List<PluginListener> earlyArrivers;
synchronized (this.pluginListeners) {
this.context = context;
this.listenersActive = true;
earlyArrivers = this.pluginListeners.entrySet().stream().filter(e -> e.getValue().isEmpty())
.map(Entry::getKey).collect(Collectors.toList());
}
earlyArrivers.stream().forEach(pl -> {
// Always create trackers without holding any monitors or locks
// to avoid potential deadlock
List<PluginTracker<?>> trackers = createTrackers(pl);
synchronized (this.pluginListeners) {
if (this.listenersActive) {
// We should only add the trackers if the plugin is still
// in the map with an empty collection
List<PluginTracker<?>> old = this.pluginListeners.get(pl);
if (old != null && old.isEmpty()) {
this.pluginListeners.put(pl, trackers);
trackers = Collections.emptyList();
}
}
}
// If our trackers weren't added then close them
trackers.forEach(PluginTracker::close);
});
}
ApiFactoryServiceImpl.java 文件源码
java
阅读 28
收藏 0
点赞 0
评论 0
项目:osc-core
作者:
评论列表
文章目录