public class ConnectionHub extends HapiContextSupport
Provides access to shared HL7 Connections. The ConnectionHub has at most one connection to any given address at any time.
Synchronization Note: This class should be safe to use in a multithreaded environment. A synchronization mutex is maintained for any given target host and port, so that if two threads are trying to connect to two separate destinations neither will block, but if two threads are trying to connect to the same destination, one will block until the other has finished trying. Use caution if this class is to be used in an environment where a very large (over 1000) number of target host/port destinations will be accessed at the same time.
Modifier and Type | Field and Description |
---|---|
static String |
MAX_CONCURRENT_TARGETS
Set a system property with this key to a string containing an integer larger than the default
("1000") if you need to connect to a very large number of targets at the same time in a
multithreaded environment.
|
Modifier and Type | Method and Description |
---|---|
Set<? extends ca.uhn.hl7v2.app.ConnectionData> |
allConnections() |
Connection |
attach(ca.uhn.hl7v2.app.ConnectionData data) |
Connection |
attach(DefaultHapiContext hapiContext,
String host,
int port,
boolean tls) |
Connection |
attach(DefaultHapiContext hapiContext,
String host,
int outboundPort,
int inboundPort,
boolean tls) |
Connection |
attach(String host,
int port,
boolean tls)
Returns a Connection to the given address, opening this Connection if necessary.
|
Connection |
attach(String host,
int outboundPort,
int inboundPort,
boolean tls) |
Connection |
attach(String host,
int outboundPort,
int inboundPort,
Parser parser,
Class<? extends LowerLayerProtocol> llpClass) |
Connection |
attach(String host,
int outboundPort,
int inboundPort,
Parser parser,
Class<? extends LowerLayerProtocol> llpClass,
boolean tls) |
Connection |
attach(String host,
int outboundPort,
int inboundPort,
Parser parser,
LowerLayerProtocol llp,
boolean tls) |
Connection |
attach(String host,
int outboundPort,
int inboundPort,
Parser parser,
LowerLayerProtocol llp,
boolean tls,
SocketFactory socketFactory) |
Connection |
attach(String host,
int port,
Parser parser,
Class<? extends LowerLayerProtocol> llpClass) |
Connection |
attach(String host,
int port,
Parser parser,
Class<? extends LowerLayerProtocol> llpClass,
boolean tls) |
Connection |
attach(String host,
int port,
Parser parser,
LowerLayerProtocol llp) |
Connection |
attach(String host,
int port,
Parser parser,
LowerLayerProtocol llp,
boolean tls) |
Connection |
attach(String host,
int port,
Parser parser,
LowerLayerProtocol llp,
boolean tls,
SocketFactory socketFactory) |
Connection |
attachLazily(DefaultHapiContext hapiContext,
String host,
int port,
boolean tls) |
Connection |
attachLazily(DefaultHapiContext hapiContext,
String host,
int outboundPort,
int inboundPort,
boolean tls) |
Connection |
attachLazily(String host,
int port,
boolean tls)
Returns a Connection to the given address, opening this Connection if necessary.
|
Connection |
attachLazily(String host,
int outboundPort,
int inboundPort,
boolean tls) |
Connection |
attachLazily(String host,
int outboundPort,
int inboundPort,
Parser parser,
Class<? extends LowerLayerProtocol> llpClass) |
Connection |
attachLazily(String host,
int outboundPort,
int inboundPort,
Parser parser,
Class<? extends LowerLayerProtocol> llpClass,
boolean tls) |
Connection |
attachLazily(String host,
int outboundPort,
int inboundPort,
Parser parser,
LowerLayerProtocol llp,
boolean tls) |
Connection |
attachLazily(String host,
int outboundPort,
int inboundPort,
Parser parser,
LowerLayerProtocol llp,
boolean tls,
SocketFactory socketFactory) |
Connection |
attachLazily(String host,
int port,
Parser parser,
LowerLayerProtocol llp) |
Connection |
attachLazily(String host,
int port,
Parser parser,
LowerLayerProtocol llp,
boolean tls) |
Connection |
attachLazily(String host,
int port,
Parser parser,
LowerLayerProtocol llp,
boolean tls,
SocketFactory socketFactory) |
void |
detach(Connection c)
Informs the ConnectionHub that you are done with the given Connection - if no other code is
using it, it will be closed, so you should not attempt to use a Connection after detaching
from it.
|
void |
discard(Connection c)
Closes and discards the given Connection so that it can not be returned in subsequent calls
to attach().
|
void |
discardAll()
Closes and discards all connections.
|
static ConnectionHub |
getInstance()
Deprecated.
Use
HapiContext.getConnectionHub() to get an instance of ConnectionHub.
See this example page for an example of how to use ConnectionHub. |
static ConnectionHub |
getInstance(ExecutorService service)
Deprecated.
Use
HapiContext.getConnectionHub() to get an instance of ConnectionHub.
See this example page for an example of how to use ConnectionHub. |
static ConnectionHub |
getInstance(HapiContext context)
Deprecated.
Use
HapiContext.getConnectionHub() to get an instance of ConnectionHub.
See this example page for an example of how to use ConnectionHub. |
Connection |
getKnownConnection(ca.uhn.hl7v2.app.ConnectionData key) |
static ConnectionHub |
getNewInstance(HapiContext context)
Returns a new (non-singleton) instance of the ConnectionHub which uses the given executor
service.
|
boolean |
isOpen(ca.uhn.hl7v2.app.ConnectionData key) |
static void |
shutdown()
Deprecated.
default executor service is shut down automatically
|
getHapiContext, setHapiContext
public static final String MAX_CONCURRENT_TARGETS
public Set<? extends ca.uhn.hl7v2.app.ConnectionData> allConnections()
public Connection attach(ca.uhn.hl7v2.app.ConnectionData data) throws HL7Exception
HL7Exception
public Connection attach(String host, int port, boolean tls) throws HL7Exception
Connection.getParser()
.HL7Exception
public Connection attachLazily(String host, int port, boolean tls) throws HL7Exception
Connection.getParser()
.HL7Exception
public Connection attach(String host, int outboundPort, int inboundPort, boolean tls) throws HL7Exception
HL7Exception
public Connection attachLazily(String host, int outboundPort, int inboundPort, boolean tls) throws HL7Exception
HL7Exception
public Connection attach(String host, int outboundPort, int inboundPort, Parser parser, Class<? extends LowerLayerProtocol> llpClass) throws HL7Exception
HL7Exception
public Connection attachLazily(String host, int outboundPort, int inboundPort, Parser parser, Class<? extends LowerLayerProtocol> llpClass) throws HL7Exception
HL7Exception
public Connection attach(String host, int outboundPort, int inboundPort, Parser parser, Class<? extends LowerLayerProtocol> llpClass, boolean tls) throws HL7Exception
HL7Exception
public Connection attachLazily(String host, int outboundPort, int inboundPort, Parser parser, Class<? extends LowerLayerProtocol> llpClass, boolean tls) throws HL7Exception
HL7Exception
public Connection attach(String host, int outboundPort, int inboundPort, Parser parser, LowerLayerProtocol llp, boolean tls) throws HL7Exception
HL7Exception
public Connection attachLazily(String host, int outboundPort, int inboundPort, Parser parser, LowerLayerProtocol llp, boolean tls) throws HL7Exception
HL7Exception
public Connection attach(String host, int outboundPort, int inboundPort, Parser parser, LowerLayerProtocol llp, boolean tls, SocketFactory socketFactory) throws HL7Exception
HL7Exception
public Connection attachLazily(String host, int outboundPort, int inboundPort, Parser parser, LowerLayerProtocol llp, boolean tls, SocketFactory socketFactory) throws HL7Exception
HL7Exception
public Connection attach(String host, int port, Parser parser, LowerLayerProtocol llp, boolean tls, SocketFactory socketFactory) throws HL7Exception
HL7Exception
public Connection attachLazily(String host, int port, Parser parser, LowerLayerProtocol llp, boolean tls, SocketFactory socketFactory) throws HL7Exception
HL7Exception
public Connection attach(DefaultHapiContext hapiContext, String host, int port, boolean tls) throws HL7Exception
HL7Exception
public Connection attachLazily(DefaultHapiContext hapiContext, String host, int port, boolean tls) throws HL7Exception
HL7Exception
public Connection attach(DefaultHapiContext hapiContext, String host, int outboundPort, int inboundPort, boolean tls) throws HL7Exception
HL7Exception
public Connection attachLazily(DefaultHapiContext hapiContext, String host, int outboundPort, int inboundPort, boolean tls) throws HL7Exception
HL7Exception
public Connection attach(String host, int port, Parser parser, Class<? extends LowerLayerProtocol> llpClass) throws HL7Exception
HL7Exception
public Connection attach(String host, int port, Parser parser, Class<? extends LowerLayerProtocol> llpClass, boolean tls) throws HL7Exception
HL7Exception
public Connection attach(String host, int port, Parser parser, LowerLayerProtocol llp) throws HL7Exception
HL7Exception
public Connection attachLazily(String host, int port, Parser parser, LowerLayerProtocol llp) throws HL7Exception
HL7Exception
public Connection attach(String host, int port, Parser parser, LowerLayerProtocol llp, boolean tls) throws HL7Exception
HL7Exception
public Connection attachLazily(String host, int port, Parser parser, LowerLayerProtocol llp, boolean tls) throws HL7Exception
HL7Exception
public void detach(Connection c)
public void discard(Connection c)
public void discardAll()
public Connection getKnownConnection(ca.uhn.hl7v2.app.ConnectionData key)
public boolean isOpen(ca.uhn.hl7v2.app.ConnectionData key)
public static ConnectionHub getInstance()
HapiContext.getConnectionHub()
to get an instance of ConnectionHub.
See this example page for an example of how to use ConnectionHub.public static ConnectionHub getInstance(ExecutorService service)
HapiContext.getConnectionHub()
to get an instance of ConnectionHub.
See this example page for an example of how to use ConnectionHub.public static ConnectionHub getInstance(HapiContext context)
HapiContext.getConnectionHub()
to get an instance of ConnectionHub.
See this example page for an example of how to use ConnectionHub.public static ConnectionHub getNewInstance(HapiContext context)
Returns a new (non-singleton) instance of the ConnectionHub which uses the given executor service.
See this example page for an example of how to use ConnectionHub.
public static void shutdown()
Copyright © 2001–2017 University Health Network. All rights reserved.