org.regenstrief.xhl7
Class MLLPServer

java.lang.Object
  extended byjava.lang.Thread
      extended byorg.regenstrief.xhl7.MLLPServer
All Implemented Interfaces:
java.lang.Runnable

public class MLLPServer
extends java.lang.Thread

An HL7 MLLP server that transforms an HL7 received.

Configuration file is in XML. See ConfigurationHandler.

The MLLP server is a multi-threaded thing. It's started by reading the configuration file and the configuration drives all other actions. At the end of each server element, that server is started in a thread of its own (how about using select?) Then each sever thread spawns off handler threads, where a handler thread. For now we use default saturation behavior. It's simple minded but used to be the standard on UNIX and C for so many years, so it's not going to be a big concern now.

I am exceedingly inclined to put more rather than less functions into a single compilation unit. Particularly I hate to put little helper classes such as Exceptions or ContentHandlers into separate files, let alone make them public classes.

We have here, the MLLPServer class that has the following phases and threads:

  1. static main, initialize - the startup thread, creates the
  2. ConfigurationHandler - the helper object that creates one MLLPServer per each server element in configuration. This is a ContentHandlder called back by the SAX parser.
  3. MLLPServer object - one per server element, this is the acceptor thread.
  4. Handler thread, each handling one connection.

Notice, this is a Java application, not really an API. You can of course launch it by calling the static main() method, anything beyond that is at your own risk.


Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Method Summary
static void main(java.lang.String[] args)
          Main entry point.
 void run()
          Called by Thread.start().
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Main entry point.

Parameters:
args - one argument, the URL of the configuration file.
Throws:
java.lang.Excpetion - if anthing goes wrong.
java.lang.Exception

run

public void run()
Called by Thread.start().