class_ptr = (*jvm_env)->GetObjectClass (jvm_env, object_ptr);
- if (ds_type == DS_TYPE_COUNTER)
+ if (ds_type == DS_TYPE_GAUGE)
{
- jlong tmp_long;
+ jdouble tmp_double;
- status = jtoc_long (jvm_env, &tmp_long,
- class_ptr, object_ptr, "longValue");
+ status = jtoc_double (jvm_env, &tmp_double,
+ class_ptr, object_ptr, "doubleValue");
if (status != 0)
{
ERROR ("java plugin: jtoc_value: "
- "jtoc_long failed.");
+ "jtoc_double failed.");
return (-1);
}
- (*ret_value).counter = (counter_t) tmp_long;
+ (*ret_value).gauge = (gauge_t) tmp_double;
}
else
{
- jdouble tmp_double;
+ jlong tmp_long;
- status = jtoc_double (jvm_env, &tmp_double,
- class_ptr, object_ptr, "doubleValue");
+ status = jtoc_long (jvm_env, &tmp_long,
+ class_ptr, object_ptr, "longValue");
if (status != 0)
{
ERROR ("java plugin: jtoc_value: "
- "jtoc_double failed.");
+ "jtoc_long failed.");
return (-1);
}
- (*ret_value).gauge = (gauge_t) tmp_double;
+
+ if (ds_type == DS_TYPE_DERIVE)
+ (*ret_value).derive = (derive_t) tmp_long;
+ else if (ds_type == DS_TYPE_ABSOLUTE)
+ (*ret_value).absolute = (absolute_t) tmp_long;
+ else
+ (*ret_value).counter = (counter_t) tmp_long;
}
return (0);