Lines Matching full:env
72 static void s_mqtt_connection_destroy(JNIEnv *env, struct mqtt_jni_connection *connection);
107 JNIEnv *env) { in s_mqtt_jni_async_callback_new() argument
109 if (env == NULL) { in s_mqtt_jni_async_callback_new()
117 callback->async_callback = async_callback ? (*env)->NewGlobalRef(env, async_callback) : NULL; in s_mqtt_jni_async_callback_new()
123 static void s_mqtt_jni_async_callback_destroy(struct mqtt_jni_async_callback *callback, JNIEnv *env… in s_mqtt_jni_async_callback_destroy() argument
126 if (env == NULL) { in s_mqtt_jni_async_callback_destroy()
131 (*env)->DeleteGlobalRef(env, callback->async_callback); in s_mqtt_jni_async_callback_destroy()
140 static jobject s_new_mqtt_exception(JNIEnv *env, int error_code) { in s_new_mqtt_exception() argument
141 jobject exception = (*env)->NewObject( in s_new_mqtt_exception()
142 …env, mqtt_exception_properties.jni_mqtt_exception, mqtt_exception_properties.jni_constructor, erro… in s_new_mqtt_exception()
174 /********** JNI ENV ACQUIRE **********/ in s_on_connection_complete()
176 JNIEnv *env = aws_jni_acquire_thread_env(jvm); in s_on_connection_complete() local
177 if (env == NULL) { in s_on_connection_complete()
182 jobject mqtt_connection = (*env)->NewLocalRef(env, connection->java_mqtt_connection); in s_on_connection_complete()
184 (*env)->CallVoidMethod( in s_on_connection_complete()
185 …env, mqtt_connection, mqtt_connection_properties.on_connection_complete, error_code, session_prese… in s_on_connection_complete()
187 (*env)->DeleteLocalRef(env, mqtt_connection); in s_on_connection_complete()
189 if (aws_jni_check_and_clear_exception(env)) { in s_on_connection_complete()
190 aws_jni_release_thread_env(connection->jvm, env); in s_on_connection_complete()
191 /********** JNI ENV RELEASE EARLY OUT **********/ in s_on_connection_complete()
197 s_mqtt_jni_async_callback_destroy(connect_callback, env); in s_on_connection_complete()
199 aws_jni_release_thread_env(jvm, env); in s_on_connection_complete()
200 /********** JNI ENV RELEASE **********/ in s_on_connection_complete()
208 JNIEnv *env) { in s_on_connection_interrupted_internal() argument
210 AWS_FATAL_ASSERT(env); in s_on_connection_interrupted_internal()
212 jobject mqtt_connection = (*env)->NewLocalRef(env, connection->java_mqtt_connection); in s_on_connection_interrupted_internal()
214 (*env)->CallVoidMethod( in s_on_connection_interrupted_internal()
215 …env, mqtt_connection, mqtt_connection_properties.on_connection_interrupted, error_code, ack_callba… in s_on_connection_interrupted_internal()
217 (*env)->DeleteLocalRef(env, mqtt_connection); in s_on_connection_interrupted_internal()
219 AWS_FATAL_ASSERT(!aws_jni_check_and_clear_exception(env)); in s_on_connection_interrupted_internal()
231 /********** JNI ENV ACQUIRE **********/ in s_on_connection_interrupted()
232 JNIEnv *env = aws_jni_acquire_thread_env(connection->jvm); in s_on_connection_interrupted() local
233 if (env == NULL) { in s_on_connection_interrupted()
238 s_on_connection_interrupted_internal(user_data, error_code, NULL, env); in s_on_connection_interrupted()
240 aws_jni_release_thread_env(connection->jvm, env); in s_on_connection_interrupted()
241 /********** JNI ENV RELEASE **********/ in s_on_connection_interrupted()
254 /********** JNI ENV ACQUIRE **********/ in s_on_connection_success()
255 JNIEnv *env = aws_jni_acquire_thread_env(connection->jvm); in s_on_connection_success() local
256 if (env == NULL) { in s_on_connection_success()
260 jobject mqtt_connection = (*env)->NewLocalRef(env, connection->java_mqtt_connection); in s_on_connection_success()
263 …(*env)->CallVoidMethod(env, mqtt_connection, mqtt_connection_properties.on_connection_success, ses… in s_on_connection_success()
265 (*env)->DeleteLocalRef(env, mqtt_connection); in s_on_connection_success()
267 AWS_FATAL_ASSERT(!aws_jni_check_and_clear_exception(env)); in s_on_connection_success()
269 aws_jni_release_thread_env(connection->jvm, env); in s_on_connection_success()
270 /********** JNI ENV RELEASE **********/ in s_on_connection_success()
281 /********** JNI ENV ACQUIRE **********/ in s_on_connection_failure()
282 JNIEnv *env = aws_jni_acquire_thread_env(connection->jvm); in s_on_connection_failure() local
283 if (env == NULL) { in s_on_connection_failure()
287 jobject mqtt_connection = (*env)->NewLocalRef(env, connection->java_mqtt_connection); in s_on_connection_failure()
289 …(*env)->CallVoidMethod(env, mqtt_connection, mqtt_connection_properties.on_connection_failure, err… in s_on_connection_failure()
291 (*env)->DeleteLocalRef(env, mqtt_connection); in s_on_connection_failure()
293 AWS_FATAL_ASSERT(!aws_jni_check_and_clear_exception(env)); in s_on_connection_failure()
295 aws_jni_release_thread_env(connection->jvm, env); in s_on_connection_failure()
296 /********** JNI ENV RELEASE **********/ in s_on_connection_failure()
309 /********** JNI ENV ACQUIRE **********/ in s_on_connection_resumed()
310 JNIEnv *env = aws_jni_acquire_thread_env(connection->jvm); in s_on_connection_resumed() local
311 if (env == NULL) { in s_on_connection_resumed()
316 jobject mqtt_connection = (*env)->NewLocalRef(env, connection->java_mqtt_connection); in s_on_connection_resumed()
319 …(*env)->CallVoidMethod(env, mqtt_connection, mqtt_connection_properties.on_connection_resumed, ses… in s_on_connection_resumed()
321 (*env)->DeleteLocalRef(env, mqtt_connection); in s_on_connection_resumed()
323 AWS_FATAL_ASSERT(!aws_jni_check_and_clear_exception(env)); in s_on_connection_resumed()
326 aws_jni_release_thread_env(connection->jvm, env); in s_on_connection_resumed()
327 /********** JNI ENV RELEASE **********/ in s_on_connection_resumed()
336 /********** JNI ENV ACQUIRE **********/ in s_on_connection_disconnected()
337 JNIEnv *env = aws_jni_acquire_thread_env(jni_connection->jvm); in s_on_connection_disconnected() local
338 if (env == NULL) { in s_on_connection_disconnected()
343 …ction_interrupted_internal(connect_callback->connection, 0, connect_callback->async_callback, env); in s_on_connection_disconnected()
345 s_mqtt_jni_async_callback_destroy(connect_callback, env); in s_on_connection_disconnected()
347 AWS_FATAL_ASSERT(!aws_jni_check_and_clear_exception(env)); in s_on_connection_disconnected()
349 aws_jni_release_thread_env(jni_connection->jvm, env); in s_on_connection_disconnected()
350 /********** JNI ENV RELEASE **********/ in s_on_connection_disconnected()
365 /********** JNI ENV ACQUIRE **********/ in s_on_connection_closed()
366 JNIEnv *env = aws_jni_acquire_thread_env(connection->jvm); in s_on_connection_closed() local
367 if (env == NULL) { in s_on_connection_closed()
373 if (!(*env)->IsSameObject(env, connection->java_mqtt_connection, NULL)) { in s_on_connection_closed()
374 jobject mqtt_connection = (*env)->NewLocalRef(env, connection->java_mqtt_connection); in s_on_connection_closed()
376 … (*env)->CallVoidMethod(env, mqtt_connection, mqtt_connection_properties.on_connection_closed); in s_on_connection_closed()
377 (*env)->DeleteLocalRef(env, mqtt_connection); in s_on_connection_closed()
378 AWS_FATAL_ASSERT(!aws_jni_check_and_clear_exception(env)); in s_on_connection_closed()
381 aws_jni_release_thread_env(connection->jvm, env); in s_on_connection_closed()
382 /********** JNI ENV RELEASE **********/ in s_on_connection_closed()
389 /********** JNI ENV ACQUIRE **********/ in s_on_connection_terminated()
390 JNIEnv *env = aws_jni_acquire_thread_env(jni_connection->jvm); in s_on_connection_terminated() local
391 if (env == NULL) { in s_on_connection_terminated()
396 jobject mqtt_connection = (*env)->NewLocalRef(env, jni_connection->java_mqtt_connection); in s_on_connection_terminated()
398 (*env)->CallVoidMethod(env, mqtt_connection, crt_resource_properties.release_references); in s_on_connection_terminated()
400 (*env)->DeleteLocalRef(env, mqtt_connection); in s_on_connection_terminated()
402 aws_jni_check_and_clear_exception(env); in s_on_connection_terminated()
407 s_mqtt_connection_destroy(env, jni_connection); in s_on_connection_terminated()
408 aws_jni_release_thread_env(jvm, env); in s_on_connection_terminated()
409 /********** JNI ENV RELEASE **********/ in s_on_connection_terminated()
413 JNIEnv *env, in s_mqtt_connection_new() argument
422 env, "MqttClientConnection.mqtt_connect: Out of memory allocating JNI connection"); in s_mqtt_connection_new()
427 connection->java_mqtt_connection = (*env)->NewWeakGlobalRef(env, java_mqtt_connection); in s_mqtt_connection_new()
428 jint jvmresult = (*env)->GetJavaVM(env, &connection->jvm); in s_mqtt_connection_new()
440 env, in s_mqtt_connection_new()
449 env, in s_mqtt_connection_new()
464 static void s_mqtt_connection_destroy(JNIEnv *env, struct mqtt_jni_connection *connection) { in s_mqtt_connection_destroy() argument
470 s_mqtt_jni_async_callback_destroy(connection->on_message, env); in s_mqtt_connection_destroy()
474 (*env)->DeleteWeakGlobalRef(env, connection->java_mqtt_connection); in s_mqtt_connection_destroy()
484 JNIEnv *env, in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionNewFrom311Client() argument
489 aws_cache_jni_ids(env); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionNewFrom311Client()
494 …aws_jni_throw_runtime_exception(env, "MqttClientConnection.mqtt_new: Mqtt3 Client is invalid/null"… in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionNewFrom311Client()
498 connection = s_mqtt_connection_new(env, client3, NULL, jni_mqtt_connection); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionNewFrom311Client()
514 JNIEnv *env, in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionNewFrom5Client() argument
519 aws_cache_jni_ids(env); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionNewFrom5Client()
524 …aws_jni_throw_runtime_exception(env, "MqttClientConnection.mqtt_new: Mqtt5 Client is invalid/null"… in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionNewFrom5Client()
528 connection = s_mqtt_connection_new(env, NULL, client5_jni, jni_mqtt_connection); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionNewFrom5Client()
559 JNIEnv *env, in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionDestroy() argument
563 (void)env; in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionDestroy()
564 aws_cache_jni_ids(env); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionDestroy()
575 JNIEnv *env, in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionConnect() argument
588 aws_cache_jni_ids(env); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionConnect()
592 …aws_jni_throw_runtime_exception(env, "MqttClientConnection.mqtt_connect: Connection is invalid/nul… in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionConnect()
598 struct aws_byte_cursor endpoint = aws_jni_byte_cursor_from_jstring_acquire(env, jni_endpoint); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionConnect()
602 env, in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionConnect()
607 …t mqtt_jni_async_callback *connect_callback = s_mqtt_jni_async_callback_new(connection, NULL, env); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionConnect()
609 …aws_jni_throw_runtime_exception(env, "MqttClientConnection.mqtt_connect: Failed to create async ca… in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionConnect()
634 client_id = aws_jni_byte_cursor_from_jstring_acquire(env, jni_client_id); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionConnect()
654 s_mqtt_jni_async_callback_destroy(connect_callback, env); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionConnect()
656 env, "MqttClientConnection.mqtt_connect: aws_mqtt_client_connection_connect failed"); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionConnect()
660 aws_jni_byte_cursor_from_jstring_release(env, jni_endpoint, endpoint); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionConnect()
661 aws_jni_byte_cursor_from_jstring_release(env, jni_client_id, client_id); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionConnect()
669 JNIEnv *env, in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionDisconnect() argument
674 aws_cache_jni_ids(env); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionDisconnect()
678 … aws_jni_throw_runtime_exception(env, "MqttClientConnection.mqtt_disconnect: Invalid connection"); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionDisconnect()
682 …_jni_async_callback *disconnect_callback = s_mqtt_jni_async_callback_new(connection, jni_ack, env); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionDisconnect()
684 …aws_jni_throw_runtime_exception(env, "MqttClientConnection.mqtt_disconnect: Failed to create async… in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionDisconnect()
708 static void s_deliver_ack_success(struct mqtt_jni_async_callback *callback, JNIEnv *env) { in s_deliver_ack_success() argument
713 (*env)->CallVoidMethod(env, callback->async_callback, async_callback_properties.on_success); in s_deliver_ack_success()
714 AWS_FATAL_ASSERT(!aws_jni_check_and_clear_exception(env)); in s_deliver_ack_success()
718 …void s_deliver_ack_failure(struct mqtt_jni_async_callback *callback, int error_code, JNIEnv *env) { in s_deliver_ack_failure() argument
721 AWS_FATAL_ASSERT(env); in s_deliver_ack_failure()
724 jobject jni_reason = s_new_mqtt_exception(env, error_code); in s_deliver_ack_failure()
725 …(*env)->CallVoidMethod(env, callback->async_callback, async_callback_properties.on_failure, jni_re… in s_deliver_ack_failure()
726 (*env)->DeleteLocalRef(env, jni_reason); in s_deliver_ack_failure()
727 AWS_FATAL_ASSERT(!aws_jni_check_and_clear_exception(env)); in s_deliver_ack_failure()
744 /********** JNI ENV ACQUIRE **********/ in s_on_op_complete()
746 JNIEnv *env = aws_jni_acquire_thread_env(jvm); in s_on_op_complete() local
747 if (env == NULL) { in s_on_op_complete()
752 s_deliver_ack_failure(callback, error_code, env); in s_on_op_complete()
754 s_deliver_ack_success(callback, env); in s_on_op_complete()
757 s_mqtt_jni_async_callback_destroy(callback, env); in s_on_op_complete()
759 aws_jni_release_thread_env(jvm, env); in s_on_op_complete()
760 /********** JNI ENV RELEASE **********/ in s_on_op_complete()
789 /********** JNI ENV ACQUIRE **********/ in s_cleanup_handler()
791 JNIEnv *env = aws_jni_acquire_thread_env(jvm); in s_cleanup_handler() local
792 if (env == NULL) { in s_cleanup_handler()
796 s_mqtt_jni_async_callback_destroy(handler, env); in s_cleanup_handler()
798 aws_jni_release_thread_env(jvm, env); in s_cleanup_handler()
799 /********** JNI ENV RELEASE **********/ in s_cleanup_handler()
821 /********** JNI ENV ACQUIRE **********/ in s_on_subscription_delivered()
822 JNIEnv *env = aws_jni_acquire_thread_env(callback->connection->jvm); in s_on_subscription_delivered() local
823 if (env == NULL) { in s_on_subscription_delivered()
828 jbyteArray jni_payload = (*env)->NewByteArray(env, (jsize)payload->len); in s_on_subscription_delivered()
829 …(*env)->SetByteArrayRegion(env, jni_payload, 0, (jsize)payload->len, (const signed char *)payload-… in s_on_subscription_delivered()
831 jstring jni_topic = aws_jni_string_from_cursor(env, topic); in s_on_subscription_delivered()
833 (*env)->CallVoidMethod( in s_on_subscription_delivered()
834 …env, callback->async_callback, message_handler_properties.deliver, jni_topic, jni_payload, dup, qo… in s_on_subscription_delivered()
836 (*env)->DeleteLocalRef(env, jni_payload); in s_on_subscription_delivered()
837 (*env)->DeleteLocalRef(env, jni_topic); in s_on_subscription_delivered()
839 AWS_FATAL_ASSERT(!aws_jni_check_and_clear_exception(env)); in s_on_subscription_delivered()
841 aws_jni_release_thread_env(callback->connection->jvm, env); in s_on_subscription_delivered()
842 /********** JNI ENV RELEASE **********/ in s_on_subscription_delivered()
847 JNIEnv *env, in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSubscribe() argument
855 aws_cache_jni_ids(env); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSubscribe()
859 … aws_jni_throw_runtime_exception(env, "MqttClientConnection.mqtt_subscribe: Invalid connection"); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSubscribe()
863 …uct mqtt_jni_async_callback *handler = s_mqtt_jni_async_callback_new(connection, jni_handler, env); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSubscribe()
865 …aws_jni_throw_runtime_exception(env, "MqttClientConnection.mqtt_subscribe: Unable to allocate hand… in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSubscribe()
872 sub_ack = s_mqtt_jni_async_callback_new(connection, jni_ack, env); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSubscribe()
874 …aws_jni_throw_runtime_exception(env, "MqttClientConnection.mqtt_subscribe: Unable to allocate sub … in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSubscribe()
879 struct aws_byte_cursor topic = aws_jni_byte_cursor_from_jstring_acquire(env, jni_topic); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSubscribe()
891 aws_jni_byte_cursor_from_jstring_release(env, jni_topic, topic); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSubscribe()
894 … env, "MqttClientConnection.mqtt_subscribe: aws_mqtt_client_connection_subscribe failed"); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSubscribe()
902 s_mqtt_jni_async_callback_destroy(handler, env); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSubscribe()
906 s_mqtt_jni_async_callback_destroy(sub_ack, env); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSubscribe()
914 JNIEnv *env, in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionOnMessage() argument
919 aws_cache_jni_ids(env); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionOnMessage()
923 …aws_jni_throw_runtime_exception(env, "MqttClientConnection.mqttClientConnectionOnMessage: Invalid … in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionOnMessage()
928 …aws_jni_throw_runtime_exception(env, "MqttClientConnection.mqttClientConnectionOnMessage: Invalid … in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionOnMessage()
932 …uct mqtt_jni_async_callback *handler = s_mqtt_jni_async_callback_new(connection, jni_handler, env); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionOnMessage()
935 env, "MqttClientConnection.mqttClientConnectionOnMessage: Unable to allocate handler"); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionOnMessage()
942 …env, "MqttClientConnection.mqttClientConnectionOnMessage: Failed to install on_any_publish_handler… in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionOnMessage()
947 s_mqtt_jni_async_callback_destroy(connection->on_message, env); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionOnMessage()
956 s_mqtt_jni_async_callback_destroy(handler, env); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionOnMessage()
965 JNIEnv *env, in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionUnsubscribe() argument
971 aws_cache_jni_ids(env); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionUnsubscribe()
975 … aws_jni_throw_runtime_exception(env, "MqttClientConnection.mqtt_unsubscribe: Invalid connection"); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionUnsubscribe()
979 …truct mqtt_jni_async_callback *unsub_ack = s_mqtt_jni_async_callback_new(connection, jni_ack, env); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionUnsubscribe()
981 …aws_jni_throw_runtime_exception(env, "MqttClientConnection.mqtt_unsubscribe: Unable to allocate un… in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionUnsubscribe()
985 struct aws_byte_cursor topic = aws_jni_byte_cursor_from_jstring_acquire(env, jni_topic); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionUnsubscribe()
988 aws_jni_byte_cursor_from_jstring_release(env, jni_topic, topic); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionUnsubscribe()
991 … env, "MqttClientConnection.mqtt_unsubscribe: aws_mqtt_client_connection_unsubscribe failed"); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionUnsubscribe()
999 s_mqtt_jni_async_callback_destroy(unsub_ack, env); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionUnsubscribe()
1009 JNIEnv *env, in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionPublish() argument
1018 aws_cache_jni_ids(env); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionPublish()
1022 … aws_jni_throw_runtime_exception(env, "MqttClientConnection.mqtt_publish: Invalid connection"); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionPublish()
1027 … aws_jni_throw_runtime_exception(env, "MqttClientConnection.mqtt_publish: Invalid/null topic"); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionPublish()
1031 … struct mqtt_jni_async_callback *pub_ack = s_mqtt_jni_async_callback_new(connection, jni_ack, env); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionPublish()
1033 …aws_jni_throw_runtime_exception(env, "MqttClientConnection.mqtt_publish: Unable to allocate pub ac… in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionPublish()
1037 struct aws_byte_cursor topic = aws_jni_byte_cursor_from_jstring_acquire(env, jni_topic); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionPublish()
1042 payload = aws_jni_byte_cursor_from_jbyteArray_acquire(env, jni_payload); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionPublish()
1050 aws_jni_byte_cursor_from_jstring_release(env, jni_topic, topic); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionPublish()
1053 aws_jni_byte_cursor_from_jbyteArray_release(env, jni_payload, payload); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionPublish()
1058 env, "MqttClientConnection.mqtt_publish: aws_mqtt_client_connection_publish failed"); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionPublish()
1066 s_mqtt_jni_async_callback_destroy(pub_ack, env); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionPublish()
1073 JNIEnv *env, in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSetWill() argument
1081 aws_cache_jni_ids(env); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSetWill()
1085 … aws_jni_throw_runtime_exception(env, "MqttClientConnection.mqtt_set_will: Invalid connection"); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSetWill()
1090 …aws_jni_throw_runtime_exception(env, "MqttClientConnection.mqtt_set_will: Topic must be non-null"); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSetWill()
1093 struct aws_byte_cursor topic = aws_jni_byte_cursor_from_jstring_acquire(env, jni_topic); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSetWill()
1098 payload = aws_jni_byte_cursor_from_jbyteArray_acquire(env, jni_payload); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSetWill()
1105 aws_jni_byte_cursor_from_jstring_release(env, jni_topic, topic); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSetWill()
1108 aws_jni_byte_cursor_from_jbyteArray_release(env, jni_payload, payload); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSetWill()
1115 JNIEnv *env, in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSetLogin() argument
1121 aws_cache_jni_ids(env); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSetLogin()
1125 … aws_jni_throw_runtime_exception(env, "MqttClientConnection.mqtt_set_login: Invalid connection"); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSetLogin()
1129 struct aws_byte_cursor username = aws_jni_byte_cursor_from_jstring_acquire(env, jni_user); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSetLogin()
1134 password = aws_jni_byte_cursor_from_jstring_acquire(env, jni_pass); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSetLogin()
1139 … aws_jni_throw_runtime_exception(env, "MqttClientConnection.mqtt_set_login: Failed to set login"); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSetLogin()
1142 aws_jni_byte_cursor_from_jstring_release(env, jni_user, username); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSetLogin()
1145 aws_jni_byte_cursor_from_jstring_release(env, jni_pass, password); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSetLogin()
1151 JNIEnv *env, in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSetReconnectTimeout() argument
1157 aws_cache_jni_ids(env); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSetReconnectTimeout()
1161 …aws_jni_throw_runtime_exception(env, "MqttClientConnection.mqtt_reconnect_timeout: Invalid connect… in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSetReconnectTimeout()
1168 env, "MqttClientConnection.mqtt_reconnect_timeout: Failed to set reconnect timeout"); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSetReconnectTimeout()
1190 /********** JNI ENV ACQUIRE **********/ in s_ws_handshake_transform()
1191 JNIEnv *env = aws_jni_acquire_thread_env(connection->jvm); in s_ws_handshake_transform() local
1192 if (env == NULL) { in s_ws_handshake_transform()
1212 jobject java_http_request = aws_java_http_request_from_native(env, request, NULL); in s_ws_handshake_transform()
1218 jobject mqtt_connection = (*env)->NewLocalRef(env, connection->java_mqtt_connection); in s_ws_handshake_transform()
1220 (*env)->CallVoidMethod( in s_ws_handshake_transform()
1221 …env, mqtt_connection, mqtt_connection_properties.on_websocket_handshake, java_http_request, ws_han… in s_ws_handshake_transform()
1223 (*env)->DeleteLocalRef(env, mqtt_connection); in s_ws_handshake_transform()
1225 AWS_FATAL_ASSERT(!aws_jni_check_and_clear_exception(env)); in s_ws_handshake_transform()
1228 (*env)->DeleteLocalRef(env, java_http_request); in s_ws_handshake_transform()
1229 aws_jni_release_thread_env(connection->jvm, env); in s_ws_handshake_transform()
1230 /********** JNI ENV RELEASE SUCCESS PATH **********/ in s_ws_handshake_transform()
1239 aws_jni_release_thread_env(connection->jvm, env); in s_ws_handshake_transform()
1240 /********** JNI ENV RELEASE FAILURE PATH **********/ in s_ws_handshake_transform()
1244 JNIEnv *env, in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionUseWebsockets() argument
1248 aws_cache_jni_ids(env); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionUseWebsockets()
1253 … aws_jni_throw_runtime_exception(env, "MqttClientConnection.useWebsockets: Invalid connection"); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionUseWebsockets()
1259 …aws_jni_throw_runtime_exception(env, "MqttClientConnection.useWebsockets: Failed to use websockets… in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionUseWebsockets()
1266 JNIEnv *env, in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionWebsocketHandshakeComplete() argument
1274 aws_cache_jni_ids(env); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionWebsocketHandshakeComplete()
1280 …if ((*env)->IsInstanceOf(env, jni_throwable, crt_runtime_exception_properties.crt_runtime_exceptio… in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionWebsocketHandshakeComplete()
1281 …error_code = (*env)->GetIntField(env, jni_throwable, crt_runtime_exception_properties.error_code_f… in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionWebsocketHandshakeComplete()
1292 env, jni_marshalled_request, NULL, ws_handshake->http_request)) { in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionWebsocketHandshakeComplete()
1304 JNIEnv *env, in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSetHttpProxyOptions() argument
1316 aws_cache_jni_ids(env); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSetHttpProxyOptions()
1324 …aws_jni_throw_runtime_exception(env, "MqttClientConnection.setHttpProxyOptions: proxyHost must not… in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSetHttpProxyOptions()
1330 proxy_options.host = aws_jni_byte_cursor_from_jstring_acquire(env, jni_proxy_host); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSetHttpProxyOptions()
1336 …proxy_options.auth_username = aws_jni_byte_cursor_from_jstring_acquire(env, jni_proxy_authorizatio… in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSetHttpProxyOptions()
1340 …proxy_options.auth_password = aws_jni_byte_cursor_from_jstring_acquire(env, jni_proxy_authorizatio… in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSetHttpProxyOptions()
1355 …aws_jni_throw_runtime_exception(env, "MqttClientConnection.setHttpProxyOptions: Failed to set prox… in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSetHttpProxyOptions()
1359 …aws_jni_byte_cursor_from_jstring_release(env, jni_proxy_authorization_password, proxy_options.auth… in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSetHttpProxyOptions()
1363 …aws_jni_byte_cursor_from_jstring_release(env, jni_proxy_authorization_username, proxy_options.auth… in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSetHttpProxyOptions()
1366 aws_jni_byte_cursor_from_jstring_release(env, jni_proxy_host, proxy_options.host); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionSetHttpProxyOptions()
1372 JNIEnv *env, in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionGetOperationStatistics() argument
1376 aws_cache_jni_ids(env); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionGetOperationStatistics()
1381 …aws_jni_throw_runtime_exception(env, "MqttClientConnection.getOperationStatistics: Invalid connect… in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionGetOperationStatistics()
1386 jobject jni_operation_statistics = (*env)->NewObject( in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionGetOperationStatistics()
1387 env, in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionGetOperationStatistics()
1393 … env, "MqttClientConnection.getOperationStatistics: Could not create operation statistics object"); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionGetOperationStatistics()
1400 (*env)->SetLongField( in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionGetOperationStatistics()
1401 env, in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionGetOperationStatistics()
1405 if (aws_jni_check_and_clear_exception(env)) { in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionGetOperationStatistics()
1408 … env, "MqttClientConnection.getOperationStatistics: could not create incomplete operation count"); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionGetOperationStatistics()
1412 (*env)->SetLongField( in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionGetOperationStatistics()
1413 env, in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionGetOperationStatistics()
1417 if (aws_jni_check_and_clear_exception(env)) { in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionGetOperationStatistics()
1420 … env, "MqttClientConnection.getOperationStatistics: could not create incomplete operation size"); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionGetOperationStatistics()
1424 (*env)->SetLongField( in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionGetOperationStatistics()
1425 env, in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionGetOperationStatistics()
1429 if (aws_jni_check_and_clear_exception(env)) { in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionGetOperationStatistics()
1432 … env, "MqttClientConnection.getOperationStatistics: could not create unacked operation count"); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionGetOperationStatistics()
1436 (*env)->SetLongField( in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionGetOperationStatistics()
1437 env, in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionGetOperationStatistics()
1441 if (aws_jni_check_and_clear_exception(env)) { in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionGetOperationStatistics()
1444 … env, "MqttClientConnection.getOperationStatistics: could not create unacked operation size"); in Java_software_amazon_awssdk_crt_mqtt_MqttClientConnection_mqttClientConnectionGetOperationStatistics()