Skip to content

Asynchronous Messaging

laforge49 edited this page Nov 8, 2011 · 23 revisions

The code for asynchronous message passing is not especially fast, it benchmarks at about 8 microseconds per message when the incoming message queue of the destination is empty. And while the code is pretty straight forward, the API is not designed for ease-of-use. Rather, the API supports he enhancements needed to achieve high-performance.

[MessengerThreadFactory][]

MessengerThreadFactory

The MessengerThreadFactory class is a very simple implementation of java.util.ThreadFactory and is used to create the threads used for asynchronous message passing.

/**
 * The MessengerThreadFactory is used to create threads.
 */
class MessengerThreadFactory extends ThreadFactory {
  /**
   * The newThread method returns a newly created Thread.
   */
  def newThread(runnable: Runnable) = new Thread(runnable)
}

Clone this wiki locally