Retrofit2 - OkHttp ConnectionPool threads grows to 100+ threads. Why? -


i using retrofit2 on java service connect rest api , fetch data.

the code looks this:

retrofit retrofit =         new retrofit.builder().baseurl(endpoint).addconverterfactory(jacksonconverterfactory.create())                               .build();  synccentrallojaproxysvc svc = retrofit.create(synccentrallojaproxysvc.class);  logvercentrallojaentity entity = syncsvc.getlogverbycdfilial(filial); long cd_log = (entity != null) ? entity.getcdlog() : 0;  call<logcentrallojacompactocollectiondto> call = svc.getlogcompacto(filial, cd_log);  response<logcentrallojacompactocollectiondto> response = call.execute();  //not_modified if (response.code() == 304) {     return 0; }  if (!response.issuccessful())     throw new ioexception(response.errorbody().string());  logcentrallojacompactocollectiondto body = response.body(); 

its simple data fetch runs synchronously (not in parallel) every few seconds.

i noticed throught visualvm okhttp thredas grows much. app never user 100 operations in parallel. in fact, needs one.

how tune this? natural have many threads?

visualvm thread monitor

this not normal. creating 1 retrofit instance , reusing it? or creating 1 per request?


Comments

Popular posts from this blog

vue.js - Create hooks for automated testing -

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

serial port - hub4com OVERRUN Error -