Java Interview Report
- 0of 0 votes
AnswersWhat are the disadvantages/limitations of a ConcurrentHashmap in JAVA?
- xankar April 11, 2013 in United States| Report Duplicate | Flag | PURGE
Java - 0of 0 votes
AnswerLet's say you have a fixed thread pool of size 1, internally how does this threadPool work? How is that the same thread gets used again and again.
-------
My answer: The run() methods from various classes are loaded on to a task Queue. As and when the tasks get added to to this queue, the thread keeps on acting on this queue.
Something like:
Queue qTask = new Queue();
qTask.enqueue(object1.method1());
qTask.enqueue(object2.method2());
...
- xankar April 11, 2013 in United Statespublic void run(){ while(true){ if (qTask == null or empty){ wait() } //Take tasks out of qTask }
| Report Duplicate | Flag | PURGE
Java
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.