View Javadoc
1   package ca.uhn.hl7v2.hoh.hapi.client;
2   
3   import java.net.URL;
4   import java.util.concurrent.ScheduledExecutorService;
5   
6   import ca.uhn.hl7v2.hoh.api.IClientMultithreaded;
7   import ca.uhn.hl7v2.hoh.raw.client.HohRawClientMultithreaded;
8   import ca.uhn.hl7v2.parser.Parser;
9   
10  /**
11   * <p>
12   * Message sender using the HL7 over HTTP specification which uses a 
13   * {@link ScheduledExecutorService} to provide advanced functionality such
14   * as persistent connections which time out and close automatically.
15   * </p>
16   * <p>
17   * This connector uses an executor service which can start worker threads, 
18   * so use caution if embedding within a J2EE container.
19   * </p>
20   */
21  public class HohClientMultithreaded extends AbstractClient<HohRawClientMultithreaded> implements IClientMultithreaded {
22  
23  	/**
24  	 * Constructor
25  	 */
26  	public HohClientMultithreaded() {
27  		super(new HohRawClientMultithreaded());
28  	}
29  
30  	/**
31  	 * Constructor
32  	 * 
33  	 * @param theHost
34  	 *            The HOST (name/address). E.g. "192.168.1.1"
35  	 * @param thePort
36  	 *            The PORT. E.g. "8080"
37  	 * @param theUriPath
38  	 *            The URI being requested (must either be blank or start with
39  	 *            '/' and contain a path). E.g. "/Apps/Receiver.jsp"
40  	 */
41  	public HohClientMultithreaded(String theHost, int thePort, String theUriPath) {
42  		super(new HohRawClientMultithreaded(theHost, thePort, theUriPath), null);
43  	}
44  
45  	/**
46  	 * Constructor
47  	 * 
48  	 * @param theHost
49  	 *            The HOST (name/address). E.g. "192.168.1.1"
50  	 * @param thePort
51  	 *            The PORT. E.g. "8080"
52  	 * @param theUriPath
53  	 *            The URI being requested (must either be blank or start with
54  	 *            '/' and contain a path). E.g. "/Apps/Receiver.jsp"
55  	 * @param theParser
56  	 *            The Parser to use, or <code>null</code> in which case a
57  	 *            PipeParser will be used
58  	 */
59  	public HohClientMultithreaded(String theHost, int thePort, String theUriPath, Parser theParser) {
60  		super(new HohRawClientMultithreaded(theHost, thePort, theUriPath), theParser);
61  	}
62  
63  	/**
64  	 * Constructor
65  	 * 
66  	 * @param theUrl
67  	 *            The URL to send messages to
68  	 */
69  	public HohClientMultithreaded(URL theUrl) {
70  		super(new HohRawClientMultithreaded(theUrl), null);
71  	}
72  
73  	/**
74  	 * Constructor
75  	 * 
76  	 * @param theUrl
77  	 *            The URL to send messages to
78  	 * @param theParser
79  	 *            The Parser to use, or <code>null</code> in which case a
80  	 *            PipeParser will be used
81  	 */
82  	public HohClientMultithreaded(URL theUrl, Parser theParser) {
83  		super(new HohRawClientMultithreaded(theUrl), theParser);
84  	}
85  
86  	/**
87  	 * {@inheritDoc}
88  	 */
89  	public long getSocketTimeout() {
90  		return getRawClient().getSocketTimeout();
91  	}
92  
93  	/**
94  	 * {@inheritDoc}
95  	 */
96  	public void setSocketTimeout(long theSocketTimeout) {
97  		getRawClient().setSocketTimeout(theSocketTimeout);
98  	}
99  
100 }