Rev 767 | Rev 2298 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
package in.shop2020.thrift.clients;import in.shop2020.utils.ConfigClientKeys;import in.shop2020.utils.ItemLogistics;import in.shop2020.utils.Logger;import in.shop2020.utils.HelperService.Client;import java.util.List;import java.util.Map;import javax.annotation.PostConstruct;import javax.annotation.PreDestroy;import org.apache.thrift.TException;import org.apache.thrift.transport.TTransportException;public class HelperServiceClient extends GenericServiceClient{private Client client = null;public HelperServiceClient(String clientIdentifier,String hostConfigKey, String portConfigKey) throws Exception {super(clientIdentifier, hostConfigKey, portConfigKey);client = new Client(protocol);}public HelperServiceClient() throws Exception{this(HelperServiceClient.class.getSimpleName(), ConfigClientKeys.helper_service_server_host.toString(), ConfigClientKeys.helper_service_server_port.toString());if(transport.isOpen()){Logger.log("Transport was already open", this);}try {transport.open();Logger.log("Transport opened", this);} catch (TTransportException e) {Logger.log("Encountered exception while open transport "+ e, this);}}@PostConstructpublic void openTransport(){if(transport.isOpen()){Logger.log("Transport was already open", this);}try {transport.open();} catch (TTransportException e) {Logger.log("Encountered exception while open transport "+ e, this);}}@PreDestroyprivate void closeTransport(){if(transport != null && transport.isOpen()){Logger.log("Closing transport :", this);transport.close();}}public Client getClient(){return client;}@Overridepublic void closeSession() {try {client.closeSession();} catch (TException e) {e.printStackTrace();}}}