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 |
What design pattern you have used in your project? I answered Factory pattern, how it is implemented? What are its advantage? Do know about Abstract Factory?
What are serialization and deserialization?
worst case complexities of Quick sort and Merge sort.
What is the difference between numeric and integer?
what is difference between class and object?
43 Answers College School Exams Tests, HCL,
How can we make a class singleton?
How does java enable high performance?
Can an object?s finalize() method be invoked while it is reachable?
What initialize variables?
Explain heap sort?
What is literal example?
Integer.parse Int(bf.readLine(System.out.println("enter value for n["+m+"]:"))); can it run under this