Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
jni-util.h File Reference
#include <jni.h>
#include <string>
#include <vector>
#include "common/status.h"
#include "gen-cpp/Frontend_types.h"
Include dependency graph for jni-util.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  impala::JniLocalFrame
 
struct  impala::JniMethodDescriptor
 Describes one method to look up in a Java object. More...
 
class  impala::JniUtil
 

Namespaces

 impala
 This file contains type definitions that are used throughout the code base.
 

Macros

#define THROW_IF_ERROR_WITH_LOGGING(stmt, env, adaptor)
 
#define THROW_IF_ERROR(stmt, env, impala_exc_cl)
 
#define THROW_IF_ERROR_RET(stmt, env, impala_exc_cl, ret)
 
#define THROW_IF_EXC(env, exc_class)
 
#define RETURN_IF_EXC(env)
 
#define EXIT_IF_EXC(env)
 
#define RETURN_ERROR_IF_EXC(env)
 
#define EXIT_IF_JNIERROR(stmt)
 
#define RETURN_IF_JNIERROR(stmt)
 

Functions

JNIEnv * getJNIEnv (void)
 C linkage for helper functions in hdfsJniHelper.h. More...
 

Macro Definition Documentation

#define EXIT_IF_EXC (   env)
Value:
do { \
jthrowable exc = (env)->ExceptionOccurred(); \
if (exc != NULL) { \
jstring stack = (jstring) env->CallStaticObjectMethod(JniUtil::jni_util_class(), \
(JniUtil::throwable_to_stack_trace_id()), exc); \
jboolean is_copy; \
const char* c_stack = \
reinterpret_cast<const char*>((env)->GetStringUTFChars(stack, &is_copy)); \
LOG(ERROR) << string(c_stack); \
exit(1); \
} \
} while (false)

Definition at line 85 of file jni-util.h.

Referenced by impala::Catalog::Catalog(), impala::Frontend::Frontend(), impala::InitFeSupport(), impala::InitJvmLoggingSupport(), Planner::Planner(), and impala::RequestPoolService::RequestPoolService().

#define EXIT_IF_JNIERROR (   stmt)
Value:
do { \
if ((stmt) != JNI_OK) { \
cerr << #stmt << " resulted in a jni error"; \
exit(1); \
} \
} while (false)

Definition at line 105 of file jni-util.h.

#define RETURN_IF_EXC (   env)
Value:
do { \
jthrowable exc = (env)->ExceptionOccurred(); \
if (exc != NULL) { \
jstring stack = (jstring) env->CallStaticObjectMethod(JniUtil::jni_util_class(), \
(JniUtil::throwable_to_stack_trace_id()), exc); \
jboolean is_copy; \
const char* c_stack = \
reinterpret_cast<const char*>((env)->GetStringUTFChars(stack, &is_copy)); \
VLOG(1) << string(c_stack); \
return; \
} \
} while (false)

Definition at line 71 of file jni-util.h.

#define RETURN_IF_JNIERROR (   stmt)
Value:
do { \
if ((stmt) != JNI_OK) { \
stringstream out; \
out << #stmt << " resulted in a jni error"; \
return Status(out.str()); \
} \
} while (false)

Definition at line 113 of file jni-util.h.

#define THROW_IF_ERROR (   stmt,
  env,
  impala_exc_cl 
)
Value:
do { \
Status status = (stmt); \
if (!status.ok()) { \
(env)->ThrowNew((impala_exc_cl), status.GetDetail().c_str()); \
return; \
} \
} while (false)

Definition at line 37 of file jni-util.h.

#define THROW_IF_ERROR_RET (   stmt,
  env,
  impala_exc_cl,
  ret 
)
#define THROW_IF_ERROR_WITH_LOGGING (   stmt,
  env,
  adaptor 
)
Value:
do { \
Status status = (stmt); \
if (!status.ok()) { \
(adaptor)->WriteErrorLog(); \
(adaptor)->WriteFileErrors(); \
(env)->ThrowNew((adaptor)->impala_exc_cl(), status.GetDetail().c_str()); \
return; \
} \
} while (false)

Definition at line 26 of file jni-util.h.

#define THROW_IF_EXC (   env,
  exc_class 
)
Value:
do { \
jthrowable exc = (env)->ExceptionOccurred(); \
if (exc != NULL) { \
DCHECK((throwable_to_string_id_) != NULL); \
jstring stack = (jstring) env->CallStaticObjectMethod(JniUtil::jni_util_class(), \
(JniUtil::throwable_to_stack_trace_id()), exc); \
jboolean is_copy; \
const char* c_stack = \
reinterpret_cast<const char*>((env)->GetStringUTFChars(stack, &is_copy)); \
(env)->ExceptionClear(); \
(env)->ThrowNew((exc_class), c_stack); \
return; \
} \
} while (false)

Definition at line 55 of file jni-util.h.

Function Documentation