Fixed the flaky Registrar tests.

Review: https://reviews.apache.org/r/18977
Fixed JNI call for hasNext() in requestResources.

Apparently a typical copy-paste mistake of the programmer of this
code. hasNext() was called on ArrayList instead of on iterator.

Review: https://reviews.apache.org/r/18976