Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
/****/package in.shop2020.thrift.clients;import in.shop2020.crm.CRMService.Client;import in.shop2020.utils.ConfigClientKeys;import in.shop2020.utils.Logger;import javax.annotation.PostConstruct;import javax.annotation.PreDestroy;import org.apache.thrift.transport.TTransportException;/*** @author mandeep**/public class CRMServiceClient extends GenericServiceClient {private Client client;public CRMServiceClient(String clientIdentifier, String hostConfigKey,String portConfigKey) throws Exception {super(clientIdentifier, hostConfigKey, portConfigKey);client = new Client(protocol);}public CRMServiceClient() throws Exception {this(CRMServiceClient.class.getSimpleName(),ConfigClientKeys.crm_service_server_host.name(),ConfigClientKeys.crm_service_server_port.name());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 opening transport: ", e);}}@PostConstructprivate 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;}/** (non-Javadoc)** @see in.shop2020.thrift.clients.GenericServiceClient#closeSession()*/@Overridepublic void closeSession() {// TODO Auto-generated method stub}}