Pass the Java app context information using two separate arrays
[lttng-ust.git] / liblttng-ust-java-agent / jni / log4j / lttng_ust_log4j.c
index b80312e2d3c72f6379d9d60d82ed8407fceeb9b4..2537922d106d76b81d42d402a56d4d430d714691 100644 (file)
@@ -73,7 +73,8 @@ JNIEXPORT void JNICALL Java_org_lttng_ust_agent_log4j_LttngLog4jApi_tracepointWi
                                                jlong timestamp,
                                                jint loglevel,
                                                jstring thread_name,
-                                               jbyteArray context_info)
+                                               jbyteArray context_info_entries,
+                                               jbyteArray context_info_strings)
 {
        jboolean iscopy;
        const char *msg_cstr = (*env)->GetStringUTFChars(env, msg, &iscopy);
@@ -82,27 +83,34 @@ JNIEXPORT void JNICALL Java_org_lttng_ust_agent_log4j_LttngLog4jApi_tracepointWi
        const char *method_name_cstr = (*env)->GetStringUTFChars(env, method_name, &iscopy);
        const char *file_name_cstr = (*env)->GetStringUTFChars(env, file_name, &iscopy);
        const char *thread_name_cstr = (*env)->GetStringUTFChars(env, thread_name, &iscopy);
-       signed char *context_info_array;
+       signed char *context_info_entries_array;
+       signed char *context_info_strings_array;
 
        /*
         * Write these to the TLS variables, so that the UST callbacks in
         * lttng_ust_context.c can access them.
         */
-       context_info_array = (*env)->GetByteArrayElements(env, context_info, &iscopy);
-       lttng_ust_context_info_tls.ctx = (struct lttng_ust_jni_ctx *) context_info_array;
-       lttng_ust_context_info_tls.len = (*env)->GetArrayLength(env, context_info);
+       context_info_entries_array = (*env)->GetByteArrayElements(env, context_info_entries, &iscopy);
+       lttng_ust_context_info_tls.ctx_entries = (struct lttng_ust_jni_ctx_entry *) context_info_entries_array;
+       lttng_ust_context_info_tls.ctx_entries_len = (*env)->GetArrayLength(env, context_info_entries);
+       context_info_strings_array = (*env)->GetByteArrayElements(env, context_info_strings, &iscopy);
+       lttng_ust_context_info_tls.ctx_strings = context_info_strings_array;
+       lttng_ust_context_info_tls.ctx_strings_len = (*env)->GetArrayLength(env, context_info_strings);
 
        tracepoint(lttng_log4j, event, msg_cstr, logger_name_cstr,
                   class_name_cstr, method_name_cstr, file_name_cstr,
                   line_number, timestamp, loglevel, thread_name_cstr);
 
-       lttng_ust_context_info_tls.ctx = NULL;
-       lttng_ust_context_info_tls.len = 0;
+       lttng_ust_context_info_tls.ctx_entries = NULL;
+       lttng_ust_context_info_tls.ctx_entries_len = 0;
+       lttng_ust_context_info_tls.ctx_strings = NULL;
+       lttng_ust_context_info_tls.ctx_strings_len = 0;
        (*env)->ReleaseStringUTFChars(env, msg, msg_cstr);
        (*env)->ReleaseStringUTFChars(env, logger_name, logger_name_cstr);
        (*env)->ReleaseStringUTFChars(env, class_name, class_name_cstr);
        (*env)->ReleaseStringUTFChars(env, method_name, method_name_cstr);
        (*env)->ReleaseStringUTFChars(env, file_name, file_name_cstr);
        (*env)->ReleaseStringUTFChars(env, thread_name, thread_name_cstr);
-       (*env)->ReleaseByteArrayElements(env, context_info, context_info_array, 0);
+       (*env)->ReleaseByteArrayElements(env, context_info_entries, context_info_entries_array, 0);
+       (*env)->ReleaseByteArrayElements(env, context_info_strings, context_info_strings_array, 0);
 }
This page took 0.024379 seconds and 4 git commands to generate.