projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
libcollectdclient: Propagate errors when signing / encrypting network packets.
[collectd.git]
/
src
/
java.c
diff --git
a/src/java.c
b/src/java.c
index
2b6a542
..
d0423be
100644
(file)
--- a/
src/java.c
+++ b/
src/java.c
@@
-17,7
+17,7
@@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors:
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors:
- * Florian octo Forster <octo at
verplant
.org>
+ * Florian octo Forster <octo at
collectd
.org>
* Justo Alonso Achaques <justo.alonso at gmail.com>
**/
* Justo Alonso Achaques <justo.alonso at gmail.com>
**/
@@
-2142,7
+2142,7
@@
static int cjni_thread_detach (void) /* {{{ */
cjni_env->jvm_env = NULL;
return (0);
cjni_env->jvm_env = NULL;
return (0);
-} /* }}}
JNIEnv *cjni_thread_at
tach */
+} /* }}}
int cjni_thread_de
tach */
static int cjni_config_add_jvm_arg (oconfig_item_t *ci) /* {{{ */
{
static int cjni_config_add_jvm_arg (oconfig_item_t *ci) /* {{{ */
{
@@
-2495,7
+2495,6
@@
static int cjni_read (user_data_t *ud) /* {{{ */
{
JNIEnv *jvm_env;
cjni_callback_info_t *cbi;
{
JNIEnv *jvm_env;
cjni_callback_info_t *cbi;
- int status;
int ret_status;
if (jvm == NULL)
int ret_status;
if (jvm == NULL)
@@
-2519,13
+2518,7
@@
static int cjni_read (user_data_t *ud) /* {{{ */
ret_status = (*jvm_env)->CallIntMethod (jvm_env, cbi->object,
cbi->method);
ret_status = (*jvm_env)->CallIntMethod (jvm_env, cbi->object,
cbi->method);
- status = cjni_thread_detach ();
- if (status != 0)
- {
- ERROR ("java plugin: cjni_read: cjni_thread_detach failed.");
- return (-1);
- }
-
+ cjni_thread_detach ();
return (ret_status);
} /* }}} int cjni_read */
return (ret_status);
} /* }}} int cjni_read */
@@
-2536,7
+2529,6
@@
static int cjni_write (const data_set_t *ds, const value_list_t *vl, /* {{{ */
JNIEnv *jvm_env;
cjni_callback_info_t *cbi;
jobject vl_java;
JNIEnv *jvm_env;
cjni_callback_info_t *cbi;
jobject vl_java;
- int status;
int ret_status;
if (jvm == NULL)
int ret_status;
if (jvm == NULL)
@@
-2561,6
+2553,7
@@
static int cjni_write (const data_set_t *ds, const value_list_t *vl, /* {{{ */
if (vl_java == NULL)
{
ERROR ("java plugin: cjni_write: ctoj_value_list failed.");
if (vl_java == NULL)
{
ERROR ("java plugin: cjni_write: ctoj_value_list failed.");
+ cjni_thread_detach ();
return (-1);
}
return (-1);
}
@@
-2569,13
+2562,7
@@
static int cjni_write (const data_set_t *ds, const value_list_t *vl, /* {{{ */
(*jvm_env)->DeleteLocalRef (jvm_env, vl_java);
(*jvm_env)->DeleteLocalRef (jvm_env, vl_java);
- status = cjni_thread_detach ();
- if (status != 0)
- {
- ERROR ("java plugin: cjni_write: cjni_thread_detach failed.");
- return (-1);
- }
-
+ cjni_thread_detach ();
return (ret_status);
} /* }}} int cjni_write */
return (ret_status);
} /* }}} int cjni_write */
@@
-2587,7
+2574,6
@@
static int cjni_flush (cdtime_t timeout, const char *identifier, /* {{{ */
cjni_callback_info_t *cbi;
jobject o_timeout;
jobject o_identifier;
cjni_callback_info_t *cbi;
jobject o_timeout;
jobject o_identifier;
- int status;
int ret_status;
if (jvm == NULL)
int ret_status;
if (jvm == NULL)
@@
-2614,6
+2600,7
@@
static int cjni_flush (cdtime_t timeout, const char *identifier, /* {{{ */
{
ERROR ("java plugin: cjni_flush: Converting double "
"to Number object failed.");
{
ERROR ("java plugin: cjni_flush: Converting double "
"to Number object failed.");
+ cjni_thread_detach ();
return (-1);
}
return (-1);
}
@@
-2625,6
+2612,7
@@
static int cjni_flush (cdtime_t timeout, const char *identifier, /* {{{ */
{
(*jvm_env)->DeleteLocalRef (jvm_env, o_timeout);
ERROR ("java plugin: cjni_flush: NewStringUTF failed.");
{
(*jvm_env)->DeleteLocalRef (jvm_env, o_timeout);
ERROR ("java plugin: cjni_flush: NewStringUTF failed.");
+ cjni_thread_detach ();
return (-1);
}
}
return (-1);
}
}
@@
-2635,13
+2623,7
@@
static int cjni_flush (cdtime_t timeout, const char *identifier, /* {{{ */
(*jvm_env)->DeleteLocalRef (jvm_env, o_identifier);
(*jvm_env)->DeleteLocalRef (jvm_env, o_timeout);
(*jvm_env)->DeleteLocalRef (jvm_env, o_identifier);
(*jvm_env)->DeleteLocalRef (jvm_env, o_timeout);
- status = cjni_thread_detach ();
- if (status != 0)
- {
- ERROR ("java plugin: cjni_flush: cjni_thread_detach failed.");
- return (-1);
- }
-
+ cjni_thread_detach ();
return (ret_status);
} /* }}} int cjni_flush */
return (ret_status);
} /* }}} int cjni_flush */
@@
-2667,7
+2649,10
@@
static void cjni_log (int severity, const char *message, /* {{{ */
o_message = (*jvm_env)->NewStringUTF (jvm_env, message);
if (o_message == NULL)
o_message = (*jvm_env)->NewStringUTF (jvm_env, message);
if (o_message == NULL)
+ {
+ cjni_thread_detach ();
return;
return;
+ }
(*jvm_env)->CallVoidMethod (jvm_env,
cbi->object, cbi->method, (jint) severity, o_message);
(*jvm_env)->CallVoidMethod (jvm_env,
cbi->object, cbi->method, (jint) severity, o_message);
@@
-2685,7
+2670,6
@@
static int cjni_notification (const notification_t *n, /* {{{ */
JNIEnv *jvm_env;
cjni_callback_info_t *cbi;
jobject o_notification;
JNIEnv *jvm_env;
cjni_callback_info_t *cbi;
jobject o_notification;
- int status;
int ret_status;
if (jvm == NULL)
int ret_status;
if (jvm == NULL)
@@
-2710,6
+2694,7
@@
static int cjni_notification (const notification_t *n, /* {{{ */
if (o_notification == NULL)
{
ERROR ("java plugin: cjni_notification: ctoj_notification failed.");
if (o_notification == NULL)
{
ERROR ("java plugin: cjni_notification: ctoj_notification failed.");
+ cjni_thread_detach ();
return (-1);
}
return (-1);
}
@@
-2718,13
+2703,7
@@
static int cjni_notification (const notification_t *n, /* {{{ */
(*jvm_env)->DeleteLocalRef (jvm_env, o_notification);
(*jvm_env)->DeleteLocalRef (jvm_env, o_notification);
- status = cjni_thread_detach ();
- if (status != 0)
- {
- ERROR ("java plugin: cjni_read: cjni_thread_detach failed.");
- return (-1);
- }
-
+ cjni_thread_detach ();
return (ret_status);
} /* }}} int cjni_notification */
return (ret_status);
} /* }}} int cjni_notification */
@@
-2752,24
+2731,20
@@
static int cjni_match_target_create (const oconfig_item_t *ci, /* {{{ */
(*jvm_env)->DeleteLocalRef (jvm_env, cbi_ret->object); \
} \
free (cbi_ret); \
(*jvm_env)->DeleteLocalRef (jvm_env, cbi_ret->object); \
} \
free (cbi_ret); \
- if (jvm_env != NULL) { \
- if (o_ci != NULL) \
- (*jvm_env)->DeleteLocalRef (jvm_env, o_ci); \
- cjni_thread_detach (); \
- } \
+ if (o_ci != NULL) \
+ (*jvm_env)->DeleteLocalRef (jvm_env, o_ci); \
+ cjni_thread_detach (); \
return (status)
if (jvm == NULL)
{
ERROR ("java plugin: cjni_read: jvm == NULL");
return (status)
if (jvm == NULL)
{
ERROR ("java plugin: cjni_read: jvm == NULL");
-
BAIL_OUT
(-1);
+
return
(-1);
}
jvm_env = cjni_thread_attach ();
if (jvm_env == NULL)
}
jvm_env = cjni_thread_attach ();
if (jvm_env == NULL)
- {
- BAIL_OUT (-1);
- }
+ return (-1);
/* Find out whether to create a match or a target. */
if (strcasecmp ("Match", ci->key) == 0)
/* Find out whether to create a match or a target. */
if (strcasecmp ("Match", ci->key) == 0)
@@
-2963,10
+2938,7
@@
static int cjni_match_target_invoke (const data_set_t *ds, /* {{{ */
}
} /* if (cbi->type == CB_TYPE_TARGET) */
}
} /* if (cbi->type == CB_TYPE_TARGET) */
- status = cjni_thread_detach ();
- if (status != 0)
- ERROR ("java plugin: cjni_read: cjni_thread_detach failed.");
-
+ cjni_thread_detach ();
return (ret_status);
} /* }}} int cjni_match_target_invoke */
return (ret_status);
} /* }}} int cjni_match_target_invoke */