Poco C++ Android JNI-ThrowExceptions

Exception or error:

I am not exactly sure if I understand it correctly, so I want to optimize the network requests a bit for my android application and used so far OkhttpClient, HttpUrlConnection, and Java Sockets but am not happy with the performance. I found a nice C++ library called Poco and thought I would give it a try so I cross compile it for the different ABIs. So far so good now the point is that I am not sure about, do I need to write my own JNI wrapper for poco so that I can use these libraries because I mean to compile it only for the different ABIs doesn’t mean I can use it right out of the box, or? And what is the best practice to do so? Do I need to add the JNI let’s call it method annotations to the .cpp files to use it?
The Reason why i think about some native library is that i start multiple http get requests to determine the throughput so i simply start 4 http requests with a countdown latch and read the bytes from the source response.body!!.source()with OkHttpClient.

        try {
            val response = client.newCall(request).execute()
            try {
                val downloadReader = response.body!!.source()
                val byteArr = ByteArray(8192)        
                while (!emitter.isCancelled && !downloadReader.exhausted()) {
                    val read = downloadReader.read(byteArr)
                    if (read == -1) {
                    } else {

So since i use RxJava i will start each http request in a Schedulers.newThread() and aggregate each emission and sample a specific time the results to do my calculation. If I observe the throughput via Android Studio Network Profiler i get too much fluctuating values see:
enter image description here

Thanks in advance

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *