public class DualTransportConnector extends Object
A utility for connecting separate inbound and outbound
TransortLayer
s 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.
Constructor and Description |
---|
DualTransportConnector(TransportLayer theTransportA,
TransportLayer theTransportB) |
Modifier and Type | Method and Description |
---|---|
void |
cancelConnect()
Cancels a connect() in progress.
|
void |
connect()
Connects both
TransportLayer s in separate threads,
and returns when both have been connected, or when cancelConnect()
is called. |
void |
disconnect() |
TransportLayer |
getTransportA() |
TransportLayer |
getTransportB() |
public DualTransportConnector(TransportLayer theTransportA, TransportLayer theTransportB)
theTransportA
- one TransportLayer
we will want to connecttheTransportB
- another onepublic TransportLayer getTransportA()
TransportLayer
s.public TransportLayer getTransportB()
TransportLayer
.public void connect() throws TransportException
TransportLayer
s in separate threads,
and returns when both have been connected, or when cancelConnect()
is called.TransportException
public void disconnect() throws TransportException
TransportException
public void cancelConnect()
Copyright © 2001–2017 University Health Network. All rights reserved.