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
How do you replace all in word?
what is the swingutilities.invokelater(runnable) method for? : Java thread
Does java allow overriding static methods ?
What is protected in java?
Add a value x to array from index l to r where 0 <= l <= r <= n-1
Can You Have Virtual Functions In Java?
Define an enumeration?
What is var keyword ?
What does the exclamation mark mean in java?
I am a fresher and know core java, c languge, html, css etc if I am illegible for any job then send it on my email tatranakshay276@gmail.com
How can the checkbox class be used to create a radio button?
What is set and get methods in java?
Can we create an object if a class doesn't have any constructor ( not even the default provided by constructor ) ?
Is java a digit method?
What are heap memory and stack memory and what are memory tables.