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 are basic keywords?
How to pass arraylist to stored procedure in java?
what is the difference between @include page and @include file
Explain the difference between an Interface and an Abstract class?
how does the run() method in runnable work? : Java thread
What is the difference between iterator and enumeration ?
What does n mean?
whays is mean by inner class?
what is heap memory?
0 Answers Tavant Technologies, Zensar,
class A { public void disp(int a,int b) { System.out.println("hai"); } } class B { public void disp(int a,int b,int c) { System.out.println("hai"); } } above program is overloading or overriding?
How do you declare an infinite loop?
can we access the super class method using subclass object?