new TephraZKClientService(zkQuorumServersString, timeOut, null, ArrayListMultimap.<String, byte[]>create()), RetryStrategies.exponentialDelay(500, retryTimeOut, TimeUnit.MILLISECONDS))
@Override public PhoenixTransactionService getTransactionService(Configuration config, ConnectionInfo connInfo, int port) { config.setInt(TxConstants.Service.CFG_DATA_TX_BIND_PORT, port); int retryTimeOut = config.getInt(TxConstants.Service.CFG_DATA_TX_CLIENT_DISCOVERY_TIMEOUT_SEC, TxConstants.Service.DEFAULT_DATA_TX_CLIENT_DISCOVERY_TIMEOUT_SEC); ZKClientService zkClient = ZKClientServices.delegate( ZKClients.reWatchOnExpire( ZKClients.retryOnFailure( ZKClientService.Builder.of(connInfo.getZookeeperConnectionString()) .setSessionTimeout(config.getInt(HConstants.ZK_SESSION_TIMEOUT, HConstants.DEFAULT_ZK_SESSION_TIMEOUT)) .build(), RetryStrategies.exponentialDelay(500, retryTimeOut, TimeUnit.MILLISECONDS) ) ) ); DiscoveryService discovery = new ZKDiscoveryService(zkClient); TransactionManager txManager = new TransactionManager(config, new HDFSTransactionStateStorage(config, new SnapshotCodecProvider(config), new TxMetricsCollector()), new TxMetricsCollector()); TransactionService txService = new TransactionService(config, zkClient, discovery, Providers.of(txManager)); TephraTransactionService service = new TephraTransactionService(zkClient, txService); service.start(); return service; }
@Provides @Singleton private ZKClientService provideZKClientService(Configuration conf) { String zkStr = conf.get(TxConstants.Service.CFG_DATA_TX_ZOOKEEPER_QUORUM); if (zkStr == null) { // Default to HBase one. zkStr = conf.get(TxConstants.HBase.ZOOKEEPER_QUORUM); } int timeOut = conf.getInt(TxConstants.HBase.ZK_SESSION_TIMEOUT, TxConstants.HBase.DEFAULT_ZK_SESSION_TIMEOUT); ZKClientService zkClientService = new TephraZKClientService(zkStr, timeOut, null, ArrayListMultimap.<String, byte[]>create()); return ZKClientServices.delegate( ZKClients.reWatchOnExpire( ZKClients.retryOnFailure(zkClientService, RetryStrategies.exponentialDelay(500, 2000, TimeUnit.MILLISECONDS) ) ) ); } }
@Provides @Singleton private ZKClientService provideZKClientService(Configuration conf) { String zkStr = conf.get(TxConstants.Service.CFG_DATA_TX_ZOOKEEPER_QUORUM); if (zkStr == null) { // Default to HBase one. zkStr = conf.get(TxConstants.HBase.ZOOKEEPER_QUORUM); } int timeOut = conf.getInt(TxConstants.HBase.ZK_SESSION_TIMEOUT, TxConstants.HBase.DEFAULT_ZK_SESSION_TIMEOUT); ZKClientService zkClientService = new TephraZKClientService(zkStr, timeOut, null, ArrayListMultimap.<String, byte[]>create()); return ZKClientServices.delegate( ZKClients.reWatchOnExpire( ZKClients.retryOnFailure(zkClientService, RetryStrategies.exponentialDelay(500, 2000, TimeUnit.MILLISECONDS) ) ) ); } }
@Provides @Singleton private ZKClientService provideZKClientService(Configuration conf) { String zkStr = conf.get(TxConstants.Service.CFG_DATA_TX_ZOOKEEPER_QUORUM); if (zkStr == null) { // Default to HBase one. zkStr = conf.get(TxConstants.HBase.ZOOKEEPER_QUORUM); } int timeOut = conf.getInt(TxConstants.HBase.ZK_SESSION_TIMEOUT, TxConstants.HBase.DEFAULT_ZK_SESSION_TIMEOUT); ZKClientService zkClientService = new TephraZKClientService(zkStr, timeOut, null, ArrayListMultimap.<String, byte[]>create()); return ZKClientServices.delegate( ZKClients.reWatchOnExpire( ZKClients.retryOnFailure(zkClientService, RetryStrategies.exponentialDelay(500, 2000, TimeUnit.MILLISECONDS) ) ) ); } }
@Provides @Singleton private ZKClientService provideZKClientService(CConfiguration cConf) { String zookeeper = cConf.get(Constants.Zookeeper.QUORUM); Preconditions.checkNotNull(zookeeper, "Missing ZooKeeper configuration '%s'", Constants.Zookeeper.QUORUM); return ZKClientServices.delegate( ZKClients.reWatchOnExpire( ZKClients.retryOnFailure( ZKClientService.Builder.of(cConf.get(Constants.Zookeeper.QUORUM)) .setSessionTimeout(cConf.getInt(Constants.Zookeeper.CFG_SESSION_TIMEOUT_MILLIS, Constants.Zookeeper.DEFAULT_SESSION_TIMEOUT_MILLIS)) .build(), RetryStrategies.exponentialDelay(500, 2000, TimeUnit.MILLISECONDS) ) ) ); } }
@Provides @Singleton private ZKClientService provideZKClientService(CConfiguration cConf) { String zookeeper = cConf.get(Constants.Zookeeper.QUORUM); Preconditions.checkNotNull(zookeeper, "Missing ZooKeeper configuration '%s'", Constants.Zookeeper.QUORUM); return ZKClientServices.delegate( ZKClients.reWatchOnExpire( ZKClients.retryOnFailure( ZKClientService.Builder.of(cConf.get(Constants.Zookeeper.QUORUM)) .setSessionTimeout(cConf.getInt(Constants.Zookeeper.CFG_SESSION_TIMEOUT_MILLIS, Constants.Zookeeper.DEFAULT_SESSION_TIMEOUT_MILLIS)) .build(), RetryStrategies.exponentialDelay(500, 2000, TimeUnit.MILLISECONDS) ) ) ); } }
@Provides @Singleton private ZKClientService provideZKClientService(CConfiguration cConf) { String zookeeper = cConf.get(Constants.Zookeeper.QUORUM); Preconditions.checkNotNull(zookeeper, "Missing Zookeeper configuration '%s'", Constants.Zookeeper.QUORUM); return ZKClientServices.delegate( ZKClients.reWatchOnExpire( ZKClients.retryOnFailure( ZKClientService.Builder.of(cConf.get(Constants.Zookeeper.QUORUM)) .setSessionTimeout(cConf.getInt(Constants.Zookeeper.CFG_SESSION_TIMEOUT_MILLIS, Constants.Zookeeper.DEFAULT_SESSION_TIMEOUT_MILLIS)) .build(), RetryStrategies.exponentialDelay(500, 2000, TimeUnit.MILLISECONDS) ) ) ); } }
private ZKClientService getZKClientService(String zkConnect) { return ZKClientServices.delegate( ZKClients.reWatchOnExpire( ZKClients.retryOnFailure(ZKClientService.Builder.of(zkConnect) .setSessionTimeout(ZK_TIMEOUT) .build(), RetryStrategies.exponentialDelay(100, 2000, TimeUnit.MILLISECONDS)))); }
private ZKClientService getZKClientService(String zkConnect) { return ZKClientServices.delegate( ZKClients.reWatchOnExpire( ZKClients.retryOnFailure(ZKClientService.Builder.of(zkConnect) .setSessionTimeout(ZK_TIMEOUT) .build(), RetryStrategies.exponentialDelay(100, 2000, TimeUnit.MILLISECONDS)))); }
Constants.Zookeeper.DEFAULT_SESSION_TIMEOUT_MILLIS)) .build(), RetryStrategies.exponentialDelay(500, 2000, TimeUnit.MILLISECONDS)
Constants.Zookeeper.DEFAULT_SESSION_TIMEOUT_MILLIS)) .build(), RetryStrategies.exponentialDelay(500, 2000, TimeUnit.MILLISECONDS)
new TephraZKClientService(zkQuorumServersString, timeOut, null, ArrayListMultimap.<String, byte[]>create()), RetryStrategies.exponentialDelay(500, retryTimeOut, TimeUnit.MILLISECONDS))
new TephraZKClientService(zkQuorumServersString, timeOut, null, ArrayListMultimap.<String, byte[]>create()), RetryStrategies.exponentialDelay(500, 2000, TimeUnit.MILLISECONDS))
@Override public PhoenixTransactionService getTransactionService(Configuration config, ConnectionInfo connInfo, int port) { config.setInt(TxConstants.Service.CFG_DATA_TX_BIND_PORT, port); int retryTimeOut = config.getInt(TxConstants.Service.CFG_DATA_TX_CLIENT_DISCOVERY_TIMEOUT_SEC, TxConstants.Service.DEFAULT_DATA_TX_CLIENT_DISCOVERY_TIMEOUT_SEC); ZKClientService zkClient = ZKClientServices.delegate( ZKClients.reWatchOnExpire( ZKClients.retryOnFailure( ZKClientService.Builder.of(connInfo.getZookeeperConnectionString()) .setSessionTimeout(config.getInt(HConstants.ZK_SESSION_TIMEOUT, HConstants.DEFAULT_ZK_SESSION_TIMEOUT)) .build(), RetryStrategies.exponentialDelay(500, retryTimeOut, TimeUnit.MILLISECONDS) ) ) ); DiscoveryService discovery = new ZKDiscoveryService(zkClient); TransactionManager txManager = new TransactionManager(config, new HDFSTransactionStateStorage(config, new SnapshotCodecProvider(config), new TxMetricsCollector()), new TxMetricsCollector()); TransactionService txService = new TransactionService(config, zkClient, discovery, Providers.of(txManager)); TephraTransactionService service = new TephraTransactionService(zkClient, txService); service.start(); return service; }
@Override public PhoenixTransactionService getTransactionService(Configuration config, ConnectionInfo connInfo) { ZKClientService zkClient = ZKClientServices.delegate( ZKClients.reWatchOnExpire( ZKClients.retryOnFailure( ZKClientService.Builder.of(connInfo.getZookeeperConnectionString()) .setSessionTimeout(config.getInt(HConstants.ZK_SESSION_TIMEOUT, HConstants.DEFAULT_ZK_SESSION_TIMEOUT)) .build(), RetryStrategies.exponentialDelay(500, 2000, TimeUnit.MILLISECONDS) ) ) ); //zkClient.startAndWait(); DiscoveryService discovery = new ZKDiscoveryService(zkClient); TransactionManager txManager = new TransactionManager(config, new HDFSTransactionStateStorage(config, new SnapshotCodecProvider(config), new TxMetricsCollector()), new TxMetricsCollector()); TransactionService txService = new TransactionService(config, zkClient, discovery, Providers.of(txManager)); TephraTransactionService service = new TephraTransactionService(zkClient, txService); //txService.startAndWait(); service.start(); return service; }