ca.uhn.hl7v2.protocol.impl
Class DualTransportConnector

java.lang.Object
  extended by ca.uhn.hl7v2.protocol.impl.DualTransportConnector

public class DualTransportConnector
extends java.lang.Object

A utility for connecting separate inbound and outbound TransortLayers in a manner that avoids deadlock.

It is not safe to call connect() on two TransportLayer in the same thread, because it blocks, and the remote system may be doing the same thing, but in the opposite order. This class provides a method that connects two layers in separate threads, and pends until they are both connected.

Version:
$Revision: 1.1 $ updated on $Date: 2007/02/19 02:24:26 $ by $Author: jamesagnew $
Author:
Bryan Tripp

Constructor Summary
DualTransportConnector(TransportLayer theTransportA, TransportLayer theTransportB)
           
 
Method Summary
 void cancelConnect()
          Cancels a connect() in progress.
 void connect()
          Connects both TransportLayers in separate threads, and returns when both have been connected, or when cancelConnect() is called.
 void disconnect()
           
 TransportLayer getTransportA()
           
 TransportLayer getTransportB()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DualTransportConnector

public DualTransportConnector(TransportLayer theTransportA,
                              TransportLayer theTransportB)
Parameters:
theTransportA - one TransportLayer we will want to connect
theTransportB - another one
Method Detail

getTransportA

public TransportLayer getTransportA()
Returns:
one of the underlying TransportLayers.

getTransportB

public TransportLayer getTransportB()
Returns:
the other underlying TransportLayer.

connect

public void connect()
             throws TransportException
Connects both TransportLayers in separate threads, and returns when both have been connected, or when cancelConnect() is called.

Throws:
TransportException

disconnect

public void disconnect()
                throws TransportException
Throws:
TransportException

cancelConnect

public void cancelConnect()
Cancels a connect() in progress. Since connect() blocks, this must be called from a separate thread.



Copyright © 2001-2011 University Health Network. All Rights Reserved.