java - Puting data in HashMap is taking too much time -
hashmap<string, object> merchantdetailmap = new hashmap<string, object>(); if(dataandsize != null) { resultlist<voltmerchantdetail> tempmerchantlist = (resultlist<voltmerchantdetail>) dataandsize.get("voltdbdatalist"); vmerchantlist = (list<voltmerchantdetail>) tempmerchantlist; for(voltmerchantdetail vmerchant : vmerchantlist){ hashmap<string, object> merchantdetails = new hashmap<string, object>(); merchantdetails.put("toactormsisdn", vmerchant.gettoactormsisdn()); merchantdetails.put("fromactormsisdn", vmerchant.getfromactormsisdn()); merchantdetails.put("customcol1", vmerchant.getcustomcol1()); merchantdetails.put("customcol2", vmerchant.getcustomcol2()); merchantdetails.put("customcol3", vmerchant.getcustomcol3()); merchantdetails.put("customcol4", vmerchant.getcustomcol4()); merchantdetails.put("customcol5", vmerchant.getcustomcol5()); merchantdetailmap.put(vmerchant.getmerusername(),merchantdetails); }
value of key (vmerchant.getmerusername()
) = papzg+jjzrss4s1frqgkra==
problem time takes time (10 - 15 minutes put elements in it) or hangs during put.
what can problem
i recommend use java profiler see taking of time.
to me, implausible creating ~20 hashmaps 7 entries , adding them hashmap taking 10 15 minutes. real problem more else; example:
- the query creating
resultlist
taking long time, - the
resultlist
has many more entries think, or - the heap full, , gc running repeatedly in last ditch attempt reclaim space.
for worth, if replaced hashmap
used represent merchantdetails simple java class 7 named fields , 7 getters and/or setters, loading process faster, , loaded map take less memory.
Comments
Post a Comment