Search in sources :

Example 1 with RetryHandlingTableMasterClient

use of alluxio.client.table.RetryHandlingTableMasterClient in project presto by prestodb.

the class AlluxioMetastoreModule method provideCatalogMasterClient.

@Provides
@Inject
TableMasterClient provideCatalogMasterClient(AlluxioHiveMetastoreConfig config) {
    InstancedConfiguration conf = new InstancedConfiguration(ConfigurationUtils.defaults());
    if (config.isZookeeperEnabled()) {
        conf.set(PropertyKey.ZOOKEEPER_ENABLED, true);
        conf.set(PropertyKey.ZOOKEEPER_ADDRESS, config.getZookeeperAddress());
    } else {
        String address = config.getMasterAddress();
        String[] parts = address.split(":", 2);
        conf.set(PropertyKey.MASTER_HOSTNAME, parts[0]);
        if (parts.length > 1) {
            conf.set(PropertyKey.MASTER_RPC_PORT, parts[1]);
        }
    }
    MasterClientContext context = MasterClientContext.newBuilder(ClientContext.create(conf)).build();
    return new RetryHandlingTableMasterClient(context);
}
Also used : InstancedConfiguration(alluxio.conf.InstancedConfiguration) MasterClientContext(alluxio.master.MasterClientContext) RetryHandlingTableMasterClient(alluxio.client.table.RetryHandlingTableMasterClient) Inject(com.google.inject.Inject) Provides(com.google.inject.Provides)

Aggregations

RetryHandlingTableMasterClient (alluxio.client.table.RetryHandlingTableMasterClient)1 InstancedConfiguration (alluxio.conf.InstancedConfiguration)1 MasterClientContext (alluxio.master.MasterClientContext)1 Inject (com.google.inject.Inject)1 Provides (com.google.inject.Provides)1