Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<blockquote> <p>1) What is Non-blocking Concurrency and how is it different.</p> </blockquote> <p>A task (thread) is non-blocking when it doesn't cause other tasks (threads) to wait until the task is finished.</p> <blockquote> <p>2) I have heard that this is available in Java. Are there any particular scenarios we should use this feature</p> </blockquote> <p>Java supports at its own multithreading. You can take benefit of it to run multiple tasks concurrently. When well written and implemented, this may speed up the program when running at a machine with multiple logical CPU's. To start, there are <a href="http://java.sun.com/javase/6/docs/api/java/lang/Runnable.html" rel="noreferrer"><code>java.lang.Runnable</code></a> and <a href="http://java.sun.com/javase/6/docs/api/java/lang/Thread.html" rel="noreferrer"><code>java.lang.Thread</code></a> as low level concurrency implementations. Then there is high level concurrency in flavor of the <a href="http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html" rel="noreferrer"><code>java.util.concurrent</code></a> API.</p> <blockquote> <p>3) Is there a difference/advantage of using one of these methods for a collection. What are the trade offs</p> </blockquote> <p>I would use <a href="http://java.sun.com/javase/6/docs/api/java/util/Collections.html#synchronizedList%28java.util.List%29" rel="noreferrer"><code>Collections#synchronizedList()</code></a>, not only because that's more robust and convenient, but also because a <code>Map</code> isn't a <code>List</code>. There's no need to attempt to homegrow one when the API already offers the facility.</p> <hr> <p>That said, there's a <a href="http://java.sun.com/docs/books/tutorial/essential/concurrency/" rel="noreferrer">Sun tutorial about Concurrency</a>. I recommend you to get yourself through it.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload