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 |
Are global variables initialized to zero?
what is Dictionary? and what purpose it is used for?
What is linked hashset and its features?
Can we change the value of static variable?
Can we force garbage collector to run ?
What is an object class?
What is a class instance variable?
Is Constructor possible in abstract class in java ?
int a=1,b=10; System.out.println(a+b--);
What is the difference between abstract class and interface1? What is an interface?
Why is the type for real numbers called double?
What is a lock or purpose of locks in java?