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
2) Suppose there are 5 directories having lot of files (say txt files) in each directory. 2 things :- 2.1) You want to search for filenames which have a particular pattern. 2.2) Out of these filtered files you want to search for a particular keyword or a search string. How can you achieve this?
Is java pass by value or pass by reference?
What is jit and its use?
Can interface be private in java?
What does t in java mean?
Is a method a procedure?
What is the order of arraylist in java?
What happens when a thread cannot acquire a lock on an object in java programming?
What is a class in java?
How to display arraylist values in java?
What is the use of string and stringbuffer?
Which package has light weight components in java programming?
Can you achieve runtime polymorphism by data members?
What is the purpose of javac exe?
Why java applets are more useful for intranets as compared to internet?