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 |
how can you say that java is independ language
What is the exception hierarchy in java?
What is the arguement of main method?
What is gc()?
How can you share data between two thread in Java?
How can we pass argument to a function by reference instead of pass by value?
What is an object?s lock? Give name of object?s that have locks?
As a developer what steps do you take to improve the performance?
How to perform merge sort in java?
How do you write a good declaration?
How do you compare two strings? any predefined method for this?
What we have to do, when we don't want to implement all methods of an interface?