/** * @since 2.1 */ public Connection attach(String host, int outboundPort, int inboundPort, Parser parser, LowerLayerProtocol llp, boolean tls, SocketFactory socketFactory) throws HL7Exception { return attach(new ConnectionData(host, outboundPort, inboundPort, parser, llp, tls, socketFactory, false)); }
public static Connection openEagerly(ConnectionData connectionData, ExecutorService executorService) throws Exception { Connection connection; if (connectionData.getPort2() == 0) { connection = new ActiveConnection(connectionData.getParser(), connectionData.getProtocol(), createSocket(connectionData.getSocketFactory(), connectionData.getHost(), connectionData.getPort(), connectionData.isTls()), executorService); } else { Socket outbound = createSocket(connectionData.getSocketFactory(), connectionData.getHost(), connectionData.getPort(), connectionData.isTls()); Socket inbound = createSocket(connectionData.getSocketFactory(), connectionData.getHost(), connectionData.getPort2(), connectionData.isTls()); connection = new ActiveConnection(connectionData.getParser(), connectionData.getProtocol(), inbound, outbound, executorService); } connection.activate(); return connection; }
/** * @since 2.0 */ public Connection attach(ConnectionData data) throws HL7Exception { try { Connection conn = null; // Disallow establishing same connection targets concurrently connectionMutexes.putIfAbsent(data.toString(), data.toString()); String mutex = connectionMutexes.get(data.toString()); synchronized (mutex) { discardConnectionIfStale(connections.get(data)); // Create connection or increase counter conn = connections.put(data); } return conn; } catch (Exception e) { log.debug("Failed to attach", e); throw new HL7Exception("Cannot open connection to " + data.getHost() + ":" + data.getPort() + "/" + data.getPort2(), e); } }
public static Connection open(ConnectionData connectionData, ExecutorService executorService) throws Exception { return connectionData.isLazy() ? new LazyConnection(connectionData, executorService) : openEagerly(connectionData, executorService); }
public static Connection open(ConnectionData connectionData, ExecutorService executorService) throws Exception { return connectionData.isLazy() ? new LazyConnection(connectionData, executorService) : openEagerly(connectionData, executorService); }
public static Connection openEagerly(ConnectionData connectionData, ExecutorService executorService) throws Exception { Connection connection; if (connectionData.getPort2() == 0) { connection = new ActiveConnection(connectionData.getParser(), connectionData.getProtocol(), createSocket(connectionData.getSocketFactory(), connectionData.getHost(), connectionData.getPort(), connectionData.isTls()), executorService); } else { Socket outbound = createSocket(connectionData.getSocketFactory(), connectionData.getHost(), connectionData.getPort(), connectionData.isTls()); Socket inbound = createSocket(connectionData.getSocketFactory(), connectionData.getHost(), connectionData.getPort2(), connectionData.isTls()); connection = new ActiveConnection(connectionData.getParser(), connectionData.getProtocol(), inbound, outbound, executorService); } connection.activate(); return connection; }
/** * @since 2.0 */ public Connection attach(ConnectionData data) throws HL7Exception { try { Connection conn = null; // Disallow establishing same connection targets concurrently connectionMutexes.putIfAbsent(data.toString(), data.toString()); String mutex = connectionMutexes.get(data.toString()); synchronized (mutex) { discardConnectionIfStale(connections.get(data)); // Create connection or increase counter conn = connections.put(data); } return conn; } catch (Exception e) { log.debug("Failed to attach", e); throw new HL7Exception("Cannot open connection to " + data.getHost() + ":" + data.getPort() + "/" + data.getPort2(), e); } }
/** * @since 2.1 */ public Connection attachLazily(String host, int outboundPort, int inboundPort, Parser parser, LowerLayerProtocol llp, boolean tls, SocketFactory socketFactory) throws HL7Exception { return attach(new ConnectionData(host, outboundPort, inboundPort, parser, llp, tls, socketFactory, true)); }
/** * @since 2.0 */ public Connection attach(String host, int outboundPort, int inboundPort, Parser parser, LowerLayerProtocol llp, boolean tls) throws HL7Exception { return attach(new ConnectionData(host, outboundPort, inboundPort, parser, llp, tls, null, false)); }
/** * @since 2.1 */ public Connection attach(String host, int port, Parser parser, LowerLayerProtocol llp, boolean tls, SocketFactory socketFactory) throws HL7Exception { return attach(new ConnectionData(host, port, 0, parser, llp, tls, socketFactory, false)); }
/** * @since 2.2 */ public Connection attachLazily(String host, int outboundPort, int inboundPort, Parser parser, LowerLayerProtocol llp, boolean tls) throws HL7Exception { return attach(new ConnectionData(host, outboundPort, inboundPort, parser, llp, tls, null, true)); }
/** * @since 2.1 */ public Connection attach(String host, int port, Parser parser, LowerLayerProtocol llp, boolean tls, SocketFactory socketFactory) throws HL7Exception { return attach(new ConnectionData(host, port, 0, parser, llp, tls, socketFactory, false)); }
/** * @since 2.1 */ public Connection attach(String host, int outboundPort, int inboundPort, Parser parser, LowerLayerProtocol llp, boolean tls, SocketFactory socketFactory) throws HL7Exception { return attach(new ConnectionData(host, outboundPort, inboundPort, parser, llp, tls, socketFactory, false)); }
/** * @since 2.0 */ public Connection attach(String host, int outboundPort, int inboundPort, Parser parser, LowerLayerProtocol llp, boolean tls) throws HL7Exception { return attach(new ConnectionData(host, outboundPort, inboundPort, parser, llp, tls, null, false)); }
/** * @since 2.2 */ public Connection attachLazily(String host, int outboundPort, int inboundPort, Parser parser, LowerLayerProtocol llp, boolean tls) throws HL7Exception { return attach(new ConnectionData(host, outboundPort, inboundPort, parser, llp, tls, null, true)); }
/** * @since 2.1 */ public Connection attachLazily(String host, int outboundPort, int inboundPort, Parser parser, LowerLayerProtocol llp, boolean tls, SocketFactory socketFactory) throws HL7Exception { return attach(new ConnectionData(host, outboundPort, inboundPort, parser, llp, tls, socketFactory, true)); }
/** * @since 2.1 */ public Connection attachLazily(String host, int port, Parser parser, LowerLayerProtocol llp, boolean tls, SocketFactory socketFactory) throws HL7Exception { return attach(new ConnectionData(host, port, 0, parser, llp, tls, socketFactory, true)); }
/** * @since 2.1 */ public Connection attachLazily(String host, int port, Parser parser, LowerLayerProtocol llp, boolean tls, SocketFactory socketFactory) throws HL7Exception { return attach(new ConnectionData(host, port, 0, parser, llp, tls, socketFactory, true)); }