title: How to achieve asynchronous computing?
body: <p>I have been thinking of different approaches to achieve asynchronous processing in Java. I thought of a few possibilities and wanted to get your opinion on whether some of them are better than other, and maybe get further suggestions on how this can be done. The most common use-case that comes to mind is sending packets of data over a connection (e.g. TCP) with the following API <code>void sendData(Data data)</code> or even <code>void sendData(Data data, Handler handler)</code>. Here are a few ideas I had:</p>
  
  <ol>
  <li>Dedicated Data sending loop - have a didicated thread, that behaves a bit like Event Dispatch Thread in Java, that all other threads call and submit a request. These requests are stored in a queue and periodically that queu is drained and all requests are sent.</li>
  <li>Use background thread to drain the queue - the Connection could maintain the list of pending requests, and have a background thread to drain the queue (with some synchronization)</li>
  <li>Executor service - pass the request to the service and call the Handler from the background thread.</li>
  <li>Asynchronous channel - most high-level approach, delegate over to the implementation</li>
  </ol>
  
  <p>Is any of those better to use, or if you have  any other general ideas in mind, please share your comments.</p>