Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
|
#include <jni-util.h>
Static Public Member Functions | |
static void | InitLibhdfs () |
Call this prior to any libhdfs calls. More... | |
static Status | Init () |
Find JniUtil class, and get JniUtil.throwableToString method id. More... | |
static bool | ClassExists (JNIEnv *env, const char *class_str) |
static Status | GetGlobalClassRef (JNIEnv *env, const char *class_str, jclass *class_ref) |
static Status | LocalToGlobalRef (JNIEnv *env, jobject local_ref, jobject *global_ref) |
static jmethodID | throwable_to_string_id () |
static jmethodID | throwable_to_stack_trace_id () |
static jclass | jni_util_class () |
Global reference to java JniUtil class. More... | |
static jclass | internal_exc_class () |
Global reference to InternalException class. More... | |
static Status | Cleanup () |
Delete all global references: class members, and those stored in global_refs_. More... | |
static Status | GetJniExceptionMsg (JNIEnv *env, bool log_stack=true, const std::string &prefix="") |
static Status | GetJvmMetrics (const TGetJvmMetricsRequest &request, TGetJvmMetricsResponse *result) |
static Status | LoadJniMethod (JNIEnv *jni_env, const jclass &jni_class, JniMethodDescriptor *descriptor) |
template<typename T > | |
static Status | CallJniMethod (const jobject &obj, const jmethodID &method, const T &arg) |
template<typename R > | |
static Status | CallJniMethod (const jobject &obj, const jmethodID &method, R *response) |
template<typename T , typename R > | |
static Status | CallJniMethod (const jobject &obj, const jmethodID &method, const T &arg, R *response) |
template<typename T > | |
static Status | CallJniMethod (const jobject &obj, const jmethodID &method, const T &arg, std::string *response) |
Static Private Attributes | |
static jclass | jni_util_cl_ = NULL |
static jclass | internal_exc_cl_ = NULL |
static jmethodID | throwable_to_string_id_ = NULL |
static jmethodID | throwable_to_stack_trace_id_ = NULL |
static jmethodID | get_jvm_metrics_id_ = NULL |
static std::vector< jobject > | global_refs_ |
Utility class for JNI-related functionality. Init() should be called as soon as the native library is loaded. Creates global class references, and promotes local references to global references. Maintains a list of all global references for cleanup in Cleanup(). Attention! Lifetime of JNI components and common pitfalls:
Definition at line 174 of file jni-util.h.
|
inlinestatic |
Utility methods to avoid repeating lots of the JNI call boilerplate. It seems these must be defined in the header to compile properly.
Definition at line 231 of file jni-util.h.
References getJNIEnv(), impala::Status::OK, impala::JniLocalFrame::push(), RETURN_ERROR_IF_EXC, RETURN_IF_ERROR, and impala::SerializeThriftMsg().
Referenced by impala::Frontend::DescribeTable(), impala::Catalog::ExecDdl(), impala::Frontend::ExecHiveServer2MetadataOp(), impala::Frontend::GetAllHadoopConfigs(), impala::Catalog::GetCatalogObject(), impala::Frontend::GetCatalogObject(), impala::Frontend::GetDataSrcMetadata(), impala::Frontend::GetDbNames(), impala::Catalog::GetDbNames(), impala::Frontend::GetExecRequest(), impala::Frontend::GetExplainPlan(), impala::Catalog::GetFunctions(), impala::Frontend::GetFunctions(), impala::Frontend::GetHadoopConfig(), GetJvmMetrics(), impala::RequestPoolService::GetPoolConfig(), impala::Frontend::GetRolePrivileges(), impala::Frontend::GetStats(), impala::Frontend::GetTableFiles(), impala::Frontend::GetTableNames(), impala::Catalog::GetTableNames(), impala::Frontend::LoadData(), impala::Catalog::PrioritizeLoad(), impala::Catalog::ResetMetadata(), impala::RequestPoolService::ResolveRequestPool(), impala::Catalog::SentryAdminCheck(), impala::Frontend::ShowCreateTable(), impala::Frontend::ShowRoles(), impala::Catalog::UpdateCatalog(), and impala::Frontend::UpdateCatalogCache().
|
inlinestatic |
Definition at line 243 of file jni-util.h.
References impala::DeserializeThriftMsg(), getJNIEnv(), impala::Status::OK, impala::JniLocalFrame::push(), RETURN_ERROR_IF_EXC, and RETURN_IF_ERROR.
|
inlinestatic |
Definition at line 255 of file jni-util.h.
References impala::DeserializeThriftMsg(), getJNIEnv(), impala::Status::OK, impala::JniLocalFrame::push(), RETURN_ERROR_IF_EXC, RETURN_IF_ERROR, and impala::SerializeThriftMsg().
|
inlinestatic |
Definition at line 270 of file jni-util.h.
References getJNIEnv(), impala::Status::OK, impala::JniLocalFrame::push(), RETURN_ERROR_IF_EXC, RETURN_IF_ERROR, and impala::SerializeThriftMsg().
|
static |
Returns true if the given class could be found on the CLASSPATH in env. Returns false otherwise, or if any other error occurred (e.g. a JNI exception). This function does not log any errors or exceptions.
Definition at line 45 of file jni-util.cc.
Referenced by impala::HBaseTableScanner::Init().
|
static |
Delete all global references: class members, and those stored in global_refs_.
Definition at line 147 of file jni-util.cc.
References getJNIEnv(), global_refs_, and impala::Status::OK.
|
static |
Returns a global JNI reference to the class specified by class_str into class_ref. The reference is added to global_refs_ for cleanup in Deinit(). Returns Status::OK if successful. Catches Java exceptions and converts their message into status.
Definition at line 56 of file jni-util.cc.
References LocalToGlobalRef(), impala::Status::OK, RETURN_ERROR_IF_EXC, and RETURN_IF_ERROR.
Referenced by impala::HBaseTableScanner::Init(), impala::HBaseTable::InitJNI(), impala::HBaseTableWriter::InitJNI(), and impala::HiveUdfCall::Open().
|
static |
Returns the error message for 'e'. If no exception, returns Status::OK log_stack determines if the stack trace is written to the log prefix, if non-empty will be prepended to the error message.
Definition at line 161 of file jni-util.cc.
References jni_util_class(), impala::Status::OK, throwable_to_stack_trace_id(), and throwable_to_string_id().
Referenced by impala::HBaseTable::Close(), impala::ExternalDataSourceExecutor::Close(), impala::HiveUdfCall::Close(), impala::HBaseTableScanner::Close(), impala::HiveUdfCall::Evaluate(), and impala::HBaseTableScanner::HandleResultScannerTimeout().
|
static |
Populates 'result' with a list of memory metrics from the Jvm. Returns Status::OK unless there is an exception.
Definition at line 188 of file jni-util.cc.
References CallJniMethod(), get_jvm_metrics_id_, and jni_util_class().
Referenced by impala::JvmMetric::CalculateValue(), and impala::JvmMetric::InitMetrics().
|
static |
Find JniUtil class, and get JniUtil.throwableToString method id.
Definition at line 74 of file jni-util.cc.
References get_jvm_metrics_id_, getJNIEnv(), internal_exc_cl_, jni_util_cl_, impala::Status::OK, throwable_to_stack_trace_id_, and throwable_to_string_id_.
Referenced by main().
|
static |
Call this prior to any libhdfs calls.
Definition at line 140 of file jni-util.cc.
Referenced by main().
|
inlinestatic |
Global reference to InternalException class.
Definition at line 206 of file jni-util.h.
References internal_exc_cl_.
Referenced by Java_com_cloudera_impala_service_FeSupport_NativeCacheJar(), Java_com_cloudera_impala_service_FeSupport_NativeEvalConstExprs(), Java_com_cloudera_impala_service_FeSupport_NativeGetStartupOptions(), Java_com_cloudera_impala_service_FeSupport_NativeLookupSymbol(), and Java_com_cloudera_impala_service_FeSupport_NativePrioritizeLoad().
|
inlinestatic |
Global reference to java JniUtil class.
Definition at line 203 of file jni-util.h.
References jni_util_cl_.
Referenced by GetJniExceptionMsg(), and GetJvmMetrics().
|
static |
Loads a method whose signature is in the supplied descriptor. Returns Status::OK and sets descriptor->method_id to a JNI method handle if successful, otherwise an error status is returned.
Definition at line 193 of file jni-util.cc.
References impala::JniMethodDescriptor::method_id, impala::JniMethodDescriptor::name, impala::Status::OK, RETURN_ERROR_IF_EXC, and impala::JniMethodDescriptor::signature.
Referenced by impala::Catalog::Catalog(), impala::Frontend::Frontend(), impala::ExternalDataSourceExecutor::Init(), and impala::RequestPoolService::RequestPoolService().
|
static |
Creates a global reference from a local reference returned into global_ref. Adds global reference to global_refs_ for cleanup in Deinit(). Returns Status::OK if successful. Catches Java exceptions and converts their message into status.
Definition at line 67 of file jni-util.cc.
References global_refs_, impala::Status::OK, and RETURN_ERROR_IF_EXC.
Referenced by impala::Catalog::Catalog(), impala::HBaseTableWriter::CreatePutList(), impala::Frontend::Frontend(), GetGlobalClassRef(), impala::HBaseTable::Init(), impala::HBaseTableFactory::Init(), impala::HBaseTableWriter::Init(), impala::HBaseTableScanner::Init(), and impala::RequestPoolService::RequestPoolService().
|
inlinestatic |
Definition at line 200 of file jni-util.h.
References throwable_to_stack_trace_id_.
Referenced by GetJniExceptionMsg().
|
inlinestatic |
Definition at line 199 of file jni-util.h.
References throwable_to_string_id_.
Referenced by GetJniExceptionMsg().
|
staticprivate |
Definition at line 294 of file jni-util.h.
Referenced by GetJvmMetrics(), and Init().
|
staticprivate |
List of global references created with GetGlobalClassRef() or LocalToGlobalRef. All global references are deleted in Cleanup().
Definition at line 297 of file jni-util.h.
Referenced by Cleanup(), and LocalToGlobalRef().
|
staticprivate |
Definition at line 291 of file jni-util.h.
Referenced by Init(), and internal_exc_class().
|
staticprivate |
Definition at line 290 of file jni-util.h.
Referenced by Init(), and jni_util_class().
|
staticprivate |
Definition at line 293 of file jni-util.h.
Referenced by Init(), and throwable_to_stack_trace_id().
|
staticprivate |
Definition at line 292 of file jni-util.h.
Referenced by Init(), and throwable_to_string_id().