last day (16 days later) » 

10:04 PM
@maaartinus hey let's chat here. Need to learn few more things :)
 
Hi@
 
hey thanks for joining in.
You mentioned about Guava's AtomicLongMap<K>
 
You're welcome!
 
It does the same stuff what we are doing as of now?
I have never heard of that
so wanted to learn about that as well
But before we start that, onSuccess method is called after this line
response = restTemplate.exchange(url, HttpMethod.GET, key.getEntity(), String.class)
right?
 
Sure... Guava has tons of good stuff. It's work studying, if you have the time.
I guess so... but I didn't really read the code (I've seen it before), I saw that working with two maps where one would do.
 
10:13 PM
ok got it.
Now if possible, can you provide an example how we will use AtomicLongMap here as well just for my learning purpose? is there any advantage with this as compared to what we are doing as of now?
 
I wrote 4 answers today, so I must concentrate on the ideas and leave the details for the askers. ;_
 
sure understood, I will go through the docs then to get more idea.
Also, do you think calling "onSuccess" for each and every call is ok?
 
Simply getAndAdd(hostname, 1) in on failure and get(hostname) in isBlocked. It doesn't save much, but it's better to use it than write own code.
calling onSuccess: I guess you have no choice. Note that the method is most probably orders of magnitude faster than accessing a remote host.
That's called premature optimization... you're supposing it could be a bottleneck and you may be right or wrong. So keep it simple and stupid and then it's easy to analyse and easy to fix.
 
yeah you are right I guess.
make sense
let me start working on it and then I will do some load testing to see how it looks like
 
Sure. You can benchmark DataMapping alone... and you'll probably see that it manages some millions of accesses per second.
 
10:22 PM
yeah thats what I am going to do now.
 
Good!
Anything else?
 
that's it, m good for now. I will start working on integrating and then do some benchmarking as well.
appreciated your help.
 
The Javadoc says that ConcurrentHashMultiset might be better. OK, you're welcome. Bye for now.
 
ConcurrentHashMultiset instead of ConcurrentMap?
 
11:06 PM
Yes, but actually instead of my prior proposal, i.e., AtomicLongMap.
 

  last day (16 days later) »