How to make a method thread safe without using synchronized
keyword?
Answer Posted / venkat
Hi Jitender,
Here the scnroniziation is happening in methodA(){}
But the same thread(Thread-0) is executing even second time
also. Could you please clarify the same.
Here is the output.
Constructor..
Thread started..Thread-0
processing....Thread-0
Thread started..Thread-1
complete..Thread-0
processing....Thread-0
complete..Thread-0
Regards,
Venkat
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
Can a class be protected in java?
What is string immutability?
What is hasnext in java?
What is the purpose of the system class in java?
Why is flag used in java?
Is int a class in java?
How do you implement polymorphism in our day to day life?
What are the changes in java.io in java 8 ?
Is heap stored in ram?
What is Hierarchy of exception?
What is method overloading in JAVA? Why is it not present in C ?
Why to use nested classes in java? (Or) what is the purpose of nested class in java?
What is structure of java heap? What is perm gen space in heap?
What is indexof?
Does A Class Inherit The Constructors Of Its Superclass?