Package ca.uhn.hl7v2.protocol.impl
Class DualTransportConnector
java.lang.Object
ca.uhn.hl7v2.protocol.impl.DualTransportConnector
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
ConstructorsConstructorDescriptionDualTransportConnector(TransportLayer theTransportA, TransportLayer theTransportB) -
Method Summary
Modifier and TypeMethodDescriptionvoidCancels a connect() in progress.voidconnect()Connects bothTransportLayers in separate threads, and returns when both have been connected, or when cancelConnect() is called.void
-
Constructor Details
-
DualTransportConnector
- Parameters:
theTransportA- oneTransportLayerwe will want to connecttheTransportB- another one
-
-
Method Details
-
getTransportA
- Returns:
- one of the underlying
TransportLayers.
-
getTransportB
- Returns:
- the other underlying
TransportLayer.
-
connect
Connects bothTransportLayers in separate threads, and returns when both have been connected, or when cancelConnect() is called.- Throws:
TransportException
-
disconnect
- Throws:
TransportException
-
cancelConnect
Cancels a connect() in progress. Since connect() blocks, this must be called from a separate thread.
-