martinzink commented on code in PR #1424: URL: https://github.com/apache/nifi-minifi-cpp/pull/1424#discussion_r1044871408
########## extensions/jni/jvm/JniReferenceObjects.h: ########## @@ -299,24 +278,26 @@ class JniSessionFactory : public core::WeakReference { } } - jobject getJavaReference() const { + [[nodiscard]] jobject getJavaReference() const { return java_object_; } - std::shared_ptr<JavaServicer> getServicer() const { + [[nodiscard]] std::shared_ptr<JavaServicer> getServicer() const { return servicer_; } - std::shared_ptr<core::ProcessSessionFactory> getFactory() const { + [[nodiscard]] std::shared_ptr<core::ProcessSessionFactory> getFactory() const { return factory_; } /** */ - JniSession *addSession(std::shared_ptr<JniSession> session) { + JniSession *addSession(const std::shared_ptr<JniSession>& session) { std::lock_guard<std::mutex> guard(session_mutex_); - sessions_.erase(std::remove_if(sessions_.begin(), sessions_.end(), check_empty()), sessions_.end()); + const auto check_empty = [](const std::shared_ptr<JniSession>& session) { return session->prune(); }; + + sessions_.erase(std::remove_if(sessions_.begin(), sessions_.end(), check_empty), sessions_.end()); Review Comment: good idea, I've simplified this and the empty() function in this file https://github.com/apache/nifi-minifi-cpp/pull/1424/commits/1b8eb634cf2055efc79d7f49f780715c6730a6dc -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org