`
codecook
  • 浏览: 41978 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

关于osgi中的2种BundleListener

阅读更多
BundleListener分为2种,一种是异步的,类名就叫BundleListener;另一种是同步的,类名叫SynchronousBundleListener.

2者都可监听当bundle 被installed, resolved, starting, started, stopping, stopped, updated, unresolved,  uninstalled.时触发的事件.只不过一个是同步,一个是异步的.

同步的可以阻挠Bundle状态的变迁,因为是在同一个线程中.比如当运行install bundle命令时,框架会先触发SynchronousBundleListener,再返回安装好的bundle.如果在SynchronousBundleListener中加入一个无限循环,则安装就不能继续下去.

SynchronousBundleListener在Felix中可以配合FileInstall这个Bundle实现Bundle更新前对Bundle进行备份等预处理操作.
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics