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 |
Can a constructor call the constructor of parent class?
what is check p object in java
Which class has no duplicate elements?
What is multi level inheritance in java?
What is the difference between call by reference and call by pointer?
What is the use of default method in interface in java?
can java object be locked down for exclusive use by a given thread? Or what happens when a thread cannot acquire a lock on an object? : Java thread
What is starvation?
How to obtain a performance profile of java program
Is java written in c?
What restrictions are placed on method overriding in java programming?
How does java pattern compile work?