OsgiListenerUtils.java 文件源码

java
阅读 32 收藏 0 点赞 0 评论 0

项目:gemini.blueprint 作者:
/**
 * Removes a service listener from the given bundle context. This method
 * simply takes care of any exceptions that might be thrown (in case the
 * context is invalid).
 * 
 * @param context bundle context to unregister the listener from
 * @param listener service listener to unregister
 * @return true if the listener unregistration has succeeded, false
 * otherwise (for example if the bundle context is invalid)
 */
public static boolean removeServiceListener(BundleContext context, ServiceListener listener) {
    if (context == null || listener == null)
        return false;

    try {
        context.removeServiceListener(listener);
        return true;
    }
    catch (IllegalStateException e) {
        // Bundle context is no longer valid
    }

    return false;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号