Search in sources :

Example 1 with TephraZKClientService

use of org.apache.tephra.zookeeper.TephraZKClientService in project phoenix by apache.

the class ConnectionQueryServicesImpl method initTxServiceClient.

private void initTxServiceClient() {
    String zkQuorumServersString = this.getProps().get(TxConstants.Service.CFG_DATA_TX_ZOOKEEPER_QUORUM);
    if (zkQuorumServersString == null) {
        zkQuorumServersString = connectionInfo.getZookeeperQuorum() + ":" + connectionInfo.getPort();
    }
    int timeOut = props.getInt(HConstants.ZK_SESSION_TIMEOUT, HConstants.DEFAULT_ZK_SESSION_TIMEOUT);
    // Create instance of the tephra zookeeper client
    txZKClientService = ZKClientServices.delegate(ZKClients.reWatchOnExpire(ZKClients.retryOnFailure(new TephraZKClientService(zkQuorumServersString, timeOut, null, ArrayListMultimap.<String, byte[]>create()), RetryStrategies.exponentialDelay(500, 2000, TimeUnit.MILLISECONDS))));
    txZKClientService.startAndWait();
    ZKDiscoveryService zkDiscoveryService = new ZKDiscoveryService(txZKClientService);
    PooledClientProvider pooledClientProvider = new PooledClientProvider(config, zkDiscoveryService);
    this.txServiceClient = new TransactionServiceClient(config, pooledClientProvider);
}
Also used : ZKDiscoveryService(org.apache.twill.discovery.ZKDiscoveryService) PTinyint(org.apache.phoenix.schema.types.PTinyint) PUnsignedTinyint(org.apache.phoenix.schema.types.PUnsignedTinyint) MultiRowMutationEndpoint(org.apache.hadoop.hbase.coprocessor.MultiRowMutationEndpoint) TephraZKClientService(org.apache.tephra.zookeeper.TephraZKClientService) PooledClientProvider(org.apache.tephra.distributed.PooledClientProvider) TransactionServiceClient(org.apache.tephra.distributed.TransactionServiceClient)

Example 2 with TephraZKClientService

use of org.apache.tephra.zookeeper.TephraZKClientService in project phoenix by apache.

the class TephraTransactionContext method setTransactionClient.

@Override
public ZKClientService setTransactionClient(Configuration config, ReadOnlyProps props, ConnectionInfo connectionInfo) {
    String zkQuorumServersString = props.get(TxConstants.Service.CFG_DATA_TX_ZOOKEEPER_QUORUM);
    if (zkQuorumServersString == null) {
        zkQuorumServersString = connectionInfo.getZookeeperQuorum() + ":" + connectionInfo.getPort();
    }
    int timeOut = props.getInt(HConstants.ZK_SESSION_TIMEOUT, HConstants.DEFAULT_ZK_SESSION_TIMEOUT);
    // Create instance of the tephra zookeeper client
    ZKClientService txZKClientService = ZKClientServices.delegate(ZKClients.reWatchOnExpire(ZKClients.retryOnFailure(new TephraZKClientService(zkQuorumServersString, timeOut, null, ArrayListMultimap.<String, byte[]>create()), RetryStrategies.exponentialDelay(500, 2000, TimeUnit.MILLISECONDS))));
    txZKClientService.startAndWait();
    ZKDiscoveryService zkDiscoveryService = new ZKDiscoveryService(txZKClientService);
    PooledClientProvider pooledClientProvider = new PooledClientProvider(config, zkDiscoveryService);
    txClient = this.txServiceClient = new TransactionServiceClient(config, pooledClientProvider);
    return txZKClientService;
}
Also used : ZKDiscoveryService(org.apache.twill.discovery.ZKDiscoveryService) ZKClientService(org.apache.twill.zookeeper.ZKClientService) TephraZKClientService(org.apache.tephra.zookeeper.TephraZKClientService) TephraZKClientService(org.apache.tephra.zookeeper.TephraZKClientService) PooledClientProvider(org.apache.tephra.distributed.PooledClientProvider) TransactionServiceClient(org.apache.tephra.distributed.TransactionServiceClient)

Aggregations

PooledClientProvider (org.apache.tephra.distributed.PooledClientProvider)2 TransactionServiceClient (org.apache.tephra.distributed.TransactionServiceClient)2 TephraZKClientService (org.apache.tephra.zookeeper.TephraZKClientService)2 ZKDiscoveryService (org.apache.twill.discovery.ZKDiscoveryService)2 MultiRowMutationEndpoint (org.apache.hadoop.hbase.coprocessor.MultiRowMutationEndpoint)1 PTinyint (org.apache.phoenix.schema.types.PTinyint)1 PUnsignedTinyint (org.apache.phoenix.schema.types.PUnsignedTinyint)1 ZKClientService (org.apache.twill.zookeeper.ZKClientService)1