@@ -146,6 +146,7 @@ BOOL setDeviceInfo(JNIEnv *env, jobject deviceInfo, PDeviceInfo pDeviceInfo)
146146 CHK_JVM_EXCEPTION (env);
147147
148148 if (!setClientInfo (env, clientInfo, &pDeviceInfo->clientInfo )) {
149+ // TODO: Consider hard failing here rather than just logging.
149150 DLOGW (" Failed getting/setting client info." );
150151 }
151152 }
@@ -158,6 +159,8 @@ BOOL setClientInfo(JNIEnv *env, jobject clientInfo, PClientInfo pClientInfo) {
158159 STATUS retStatus = STATUS_SUCCESS;
159160 jmethodID methodId = NULL ;
160161 const char *retChars;
162+ jobject kvsRetryStrategyCallbacks = NULL ;
163+ jobject kvsRetryStrategy = NULL ;
161164
162165 CHECK (env != NULL && clientInfo != NULL && pClientInfo != NULL );
163166
@@ -168,7 +171,7 @@ BOOL setClientInfo(JNIEnv *env, jobject clientInfo, PClientInfo pClientInfo) {
168171 CHK (FALSE , STATUS_INVALID_OPERATION);
169172 }
170173
171- // Retrieve the methods and call it
174+ // Retrieve the methods and call them
172175 methodId = env->GetMethodID (cls, " getVersion" , " ()I" );
173176 if (methodId == NULL ) {
174177 DLOGW (" Couldn't find method id getVersion" );
@@ -201,17 +204,17 @@ BOOL setClientInfo(JNIEnv *env, jobject clientInfo, PClientInfo pClientInfo) {
201204 CHK_JVM_EXCEPTION (env);
202205 }
203206
204- methodId = env->GetMethodID (cls, " getServiceConnectionTimeout " , " ()J" );
207+ methodId = env->GetMethodID (cls, " getServiceCallConnectionTimeout " , " ()J" );
205208 if (methodId == NULL ) {
206- DLOGW (" Couldn't find method id getServiceConnectionTimeout " );
209+ DLOGW (" Couldn't find method id getServiceCallConnectionTimeout " );
207210 } else {
208211 pClientInfo->serviceCallConnectionTimeout = env->CallLongMethod (clientInfo, methodId);
209212 CHK_JVM_EXCEPTION (env);
210213 }
211214
212- methodId = env->GetMethodID (cls, " getServiceCompletionTimeout " , " ()J" );
215+ methodId = env->GetMethodID (cls, " getServiceCallCompletionTimeout " , " ()J" );
213216 if (methodId == NULL ) {
214- DLOGW (" Couldn't find method id getServiceCompletionTimeout " );
217+ DLOGW (" Couldn't find method id getServiceCallCompletionTimeout " );
215218 } else {
216219 pClientInfo->serviceCallCompletionTimeout = env->CallLongMethod (clientInfo, methodId);
217220 CHK_JVM_EXCEPTION (env);
@@ -249,10 +252,78 @@ BOOL setClientInfo(JNIEnv *env, jobject clientInfo, PClientInfo pClientInfo) {
249252 CHK_JVM_EXCEPTION (env);
250253 }
251254
255+ methodId = env->GetMethodID (cls, " getMetricLoggingPeriod" , " ()J" );
256+ if (methodId == NULL ) {
257+ DLOGW (" Couldn't find method id getMetricLoggingPeriod" );
258+ } else {
259+ pClientInfo->metricLoggingPeriod = env->CallLongMethod (clientInfo, methodId);
260+ CHK_JVM_EXCEPTION (env);
261+ }
262+
263+ methodId = env->GetMethodID (cls, " getReservedCallbackPeriod" , " ()J" );
264+ if (methodId == NULL ) {
265+ DLOGW (" Couldn't find method id getReservedCallbackPeriod" );
266+ } else {
267+ pClientInfo->reservedCallbackPeriod = env->CallLongMethod (clientInfo, methodId);
268+ CHK_JVM_EXCEPTION (env);
269+ }
270+
271+ methodId = env->GetMethodID (cls, " getKvsRetryStrategy" , " ()Lcom/amazonaws/kinesisvideo/producer/KvsRetryStrategy;" );
272+ if (methodId == NULL ) {
273+ DLOGW (" Couldn't find method id getKvsRetryStrategy" );
274+ } else {
275+ kvsRetryStrategy = (jobject) env->CallObjectMethod (clientInfo, methodId);
276+ CHK_JVM_EXCEPTION (env);
277+
278+ if (!setKvsRetryStrategy (env, kvsRetryStrategy, &pClientInfo->kvsRetryStrategy )) {
279+ DLOGW (" Failed getting/setting KvsRetryStrategy." );
280+ }
281+ }
282+
252283CleanUp:
253284 return STATUS_FAILED (retStatus) ? FALSE : TRUE ;
254285}
255286
287+ BOOL setKvsRetryStrategy (JNIEnv *env, jobject kvsRetryStrategy, PKvsRetryStrategy pKvsRetryStrategy)
288+ {
289+ STATUS retStatus = STATUS_SUCCESS;
290+ jmethodID methodId = NULL ;
291+ jclass cls = NULL ;
292+
293+ CHK (env != NULL && pKvsRetryStrategy != NULL , STATUS_NULL_ARG);
294+ CHK_WARN (kvsRetryStrategy != NULL , STATUS_INVALID_OPERATION, " Failed to get Java kvsRetryStrategy class." );
295+
296+ cls = env->GetObjectClass (kvsRetryStrategy);
297+ CHK_WARN (cls != NULL , STATUS_INVALID_OPERATION, " Failed to create Java kvsRetryStrategy class." );
298+
299+ methodId = env->GetMethodID (cls, " getRetryStrategy" , " ()J" );
300+ if (methodId == NULL ) {
301+ DLOGW (" Couldn't find method id getRetryStrategy." );
302+ } else {
303+ // TODO: Implement once we have support for this in Java.
304+ CHK_JVM_EXCEPTION (env);
305+ }
306+
307+ methodId = env->GetMethodID (cls, " getRetryStrategyConfig" , " ()J" );
308+ if (methodId == NULL ) {
309+ DLOGW (" Couldn't find method id getRetryStrategyConfig." );
310+ } else {
311+ // TODO: Implement once we have support for this in Java.
312+ CHK_JVM_EXCEPTION (env);
313+ }
314+
315+ methodId = env->GetMethodID (cls, " getRetryStrategyType" , " ()I" );
316+ if (methodId == NULL ) {
317+ DLOGW (" Couldn't find method id getRetryStrategyType, setting retryStrategyType to EXPONENTIAL_BACKOFF_WAIT." );
318+ } else {
319+ pKvsRetryStrategy->retryStrategyType = (KVS_RETRY_STRATEGY_TYPE) env->CallIntMethod (kvsRetryStrategy, methodId);
320+ CHK_JVM_EXCEPTION (env);
321+ }
322+
323+
324+ CleanUp:
325+ return STATUS_FAILED (retStatus) ? FALSE : TRUE ;
326+ }
256327
257328BOOL setTags (JNIEnv *env, jobjectArray tagArray, PTag* ppTags, PUINT32 pTagCount)
258329{
0 commit comments