public void initialize() throws TException { if (initialized.compareAndSet(false, true)) { this.initDiscovery(); } }
protected TransactionServiceThriftClient newClient() throws TException { return newClient(-1); }
private void initializePool() throws TException { // initialize the super class (needed for service discovery) super.initialize(); // create a (empty) pool of tx clients maxClients = configuration.getInt(TxConstants.Service.CFG_DATA_TX_CLIENT_COUNT, TxConstants.Service.DEFAULT_DATA_TX_CLIENT_COUNT); if (maxClients < 1) { LOG.warn("Configuration of {} is invalid: Value is {} but must be at least 1. Using 1 as a fallback.", TxConstants.Service.CFG_DATA_TX_CLIENT_COUNT, maxClients); maxClients = 1; } obtainClientTimeoutMs = configuration.getLong(TxConstants.Service.CFG_DATA_TX_CLIENT_OBTAIN_TIMEOUT_MS, TxConstants.Service.DEFAULT_DATA_TX_CLIENT_OBTAIN_TIMEOUT_MS); if (obtainClientTimeoutMs < 0) { LOG.warn("Configuration of {} is invalid: Value is {} but must be at least 0. Using 0 as a fallback.", TxConstants.Service.CFG_DATA_TX_CLIENT_COUNT, obtainClientTimeoutMs); obtainClientTimeoutMs = 0; } this.clients = new TxClientPool(maxClients); }
protected TransactionServiceThriftClient newClient(int timeout) throws TException { initialize(); String address; int port;