6 Ekim 2015 Salı

Do synchnorized blocks or methods on Java prevent from multi thread access for every thread?

Hi,

As you read the question, I want to answer it quickly :)

Answer is, it depends. If the synchronized method is marked as "static", yes, it will work for every instances of class, because static methods belong to class, not instance.
For synchronized blocks, if they are in a static method, the same things go for them.

Otherwise, if the method is not static, it will work per instance, one's lock will not affect the other instance's synchronized block.

Have a nice day!

5 Ekim 2015 Pazartesi

Good Reference Sources for Migration of Commons HttpClient 3.x to HttpComponents HttpClient 4.x

Hi,

I had a task for replacing our Commons HttpClient 3.x dependency to HttpComponents HttpClient 4.x
As the latter one contains many changes over predecessor library, there are many things to be corrected at client side.
So, I used the sources below to accomplish my task, they were very useful, I recommend you to look at these if you have a task like mine :)

http://debuguide.blogspot.in/2013/01/quick-guide-for-migration-of-commons.html

http://www.codingpedia.org/ama/how-to-use-the-new-apache-http-client-to-make-a-head-request/

http://stackoverflow.com/questions/6024376/apache-httpcomponents-httpclient-timeout


Have a good day!