how to handle a singleton service locator. when multiple threads
are trying to get the singleton object in same time
Answers were Sorted based on User's Feedback
Answer / krishnapal
Using synchronized method we can using put requesting
threads into waiting queue.
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / wikipedia
Detailed answer here:
http://en.wikipedia.org/wiki/Singleton_pattern
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / gowramma m
Two ways to create threads
1)by creating thread class
class classname extends Thread
{
}
2)By converting class to thread ie using Runnable interface
| Is This Answer Correct ? | 1 Yes | 7 No |
Why is stringbuffer thread safe?
whats is inheritance?
15 Answers CTS, HCL,
What is the default initialized value of String type variable?
How do you compare characters in java?
How do you write a scanner class in java?
if the memory capacity is 700 presently occupied by process is 690. then another process request space(40) how this situation handled in java.
what is use of business objects?
What is update method and when it is called?
What is the benefit of using enum to declare a constant?
Briefly explain the term Spring Framework
What are synchronized methods ?
what release of java technology are currently available what do they contain?