001package ca.uhn.hl7v2.hoh.hapi.client; 002 003import java.net.URL; 004import java.util.concurrent.ScheduledExecutorService; 005 006import ca.uhn.hl7v2.hoh.api.IClientMultithreaded; 007import ca.uhn.hl7v2.hoh.raw.client.HohRawClientMultithreaded; 008import ca.uhn.hl7v2.parser.Parser; 009 010/** 011 * <p> 012 * Message sender using the HL7 over HTTP specification which uses a 013 * {@link ScheduledExecutorService} to provide advanced functionality such 014 * as persistent connections which time out and close automatically. 015 * </p> 016 * <p> 017 * This connector uses an executor service which can start worker threads, 018 * so use caution if embedding within a J2EE container. 019 * </p> 020 */ 021public class HohClientMultithreaded extends AbstractClient<HohRawClientMultithreaded> implements IClientMultithreaded { 022 023 /** 024 * Constructor 025 */ 026 public HohClientMultithreaded() { 027 super(new HohRawClientMultithreaded()); 028 } 029 030 /** 031 * Constructor 032 * 033 * @param theHost 034 * The HOST (name/address). E.g. "192.168.1.1" 035 * @param thePort 036 * The PORT. E.g. "8080" 037 * @param theUriPath 038 * The URI being requested (must either be blank or start with 039 * '/' and contain a path). E.g. "/Apps/Receiver.jsp" 040 */ 041 public HohClientMultithreaded(String theHost, int thePort, String theUriPath) { 042 super(new HohRawClientMultithreaded(theHost, thePort, theUriPath), null); 043 } 044 045 /** 046 * Constructor 047 * 048 * @param theHost 049 * The HOST (name/address). E.g. "192.168.1.1" 050 * @param thePort 051 * The PORT. E.g. "8080" 052 * @param theUriPath 053 * The URI being requested (must either be blank or start with 054 * '/' and contain a path). E.g. "/Apps/Receiver.jsp" 055 * @param theParser 056 * The Parser to use, or <code>null</code> in which case a 057 * PipeParser will be used 058 */ 059 public HohClientMultithreaded(String theHost, int thePort, String theUriPath, Parser theParser) { 060 super(new HohRawClientMultithreaded(theHost, thePort, theUriPath), theParser); 061 } 062 063 /** 064 * Constructor 065 * 066 * @param theUrl 067 * The URL to send messages to 068 */ 069 public HohClientMultithreaded(URL theUrl) { 070 super(new HohRawClientMultithreaded(theUrl), null); 071 } 072 073 /** 074 * Constructor 075 * 076 * @param theUrl 077 * The URL to send messages to 078 * @param theParser 079 * The Parser to use, or <code>null</code> in which case a 080 * PipeParser will be used 081 */ 082 public HohClientMultithreaded(URL theUrl, Parser theParser) { 083 super(new HohRawClientMultithreaded(theUrl), theParser); 084 } 085 086 /** 087 * {@inheritDoc} 088 */ 089 public long getSocketTimeout() { 090 return getRawClient().getSocketTimeout(); 091 } 092 093 /** 094 * {@inheritDoc} 095 */ 096 public void setSocketTimeout(long theSocketTimeout) { 097 getRawClient().setSocketTimeout(theSocketTimeout); 098 } 099 100}