title: Java Non-Blocking and Asynchronous IO with NIO & NIO.2 (JSR203) - Reactor/Proactor Implementations
body: <p>So here I am reading one of my favorite software pattern books (Pattern-Oriented Software Architecture - Patterns for Concurrent and Networked Objects), specifically the sections on Proactor/Reactor asynchronous IO patterns. I can see how by using selectable channels I can implement a Reactor style asynchronous IO mechanism quite easy (and have done so). But, I cannot see how I would implement a proper Proactor mechanism with non-blocking writes. That is taking advantage of OS managed non-blocking write functions. </p>
  
  <p>Functionality supported by OS specific calls like <a href="http://msdn.microsoft.com/en-us/library/aa364986%28v=vs.85%29.aspx" rel="noreferrer">GetQueuedCompletionStatus</a> under win32. </p>
  
  <p>I did see that Java 7 brings some updates to NIO with asynchronous completion handlers (which seems to be in the right direction). That being said... Given the lack of unified cross-platform support for OS managed async operations (specifically async write) I am assuming that this is a quassy-implementation that is not utilizing native OS support.</p>
  
  <p>So my questions are, is proactor based IO handling possible in Java in such a way that it is advantageous to use for specific scenarios; and, if Java NIO does support proactor based IO handling (either in Java 6 or Java 7) is OS managed asynchronous IO support (i.e. completion callbacks from the OS) being utilized? Furthermore, if the implementation is purely in-VM are the performance benefits so little that using proactive event handling offers nothing more than a different (possibly simpler) way of constructing concurrent network handling software.</p>
  
  <p>For anyone interested in proactive event handling <a href="http://www.cse.wustl.edu/~schmidt/PDF/proactor.pdf" rel="noreferrer">here is a good article</a> that outlines pros / cons and a comparison to both traditional thread-per-connection and reactive IO models.</p>