gpt4 book ai didi

co.cask.cdap.common.guice.ZKDiscoveryModule类的使用及代码示例

转载 作者:知者 更新时间:2024-03-14 05:56:49 29 4
gpt4 key购买 nike

本文整理了Java中co.cask.cdap.common.guice.ZKDiscoveryModule类的一些代码示例,展示了ZKDiscoveryModule类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZKDiscoveryModule类的具体详情如下:
包路径:co.cask.cdap.common.guice.ZKDiscoveryModule
类名称:ZKDiscoveryModule

ZKDiscoveryModule介绍

[英]The Guice module for providing bindings for DiscoveryService and DiscoveryServiceClient that uses ZooKeeper as the service discovery mechanism.
[中]Guice模块,用于为使用ZooKeeper作为服务发现机制的DiscoveryService和DiscoveryServiceClient提供绑定。

代码示例

代码示例来源:origin: cdapio/cdap

@Override
public void init(String[] args) {
 Injector injector = Guice.createInjector(new ConfigModule(),
                      new IOModule(),
                      new ZKClientModule(),
                      new ZKDiscoveryModule(),
                      new SecurityModules().getDistributedModules());
 configuration = injector.getInstance(CConfiguration.class);
 if (configuration.getBoolean(Constants.Security.ENABLED)) {
  this.zkClientService = injector.getInstance(ZKClientService.class);
  this.authServer = injector.getInstance(ExternalAuthenticationServer.class);
 }
}

代码示例来源:origin: caskdata/cdap

@Override
protected void configure() {
 bind(ZKDiscoveryService.class).toProvider(ZKDiscoveryServiceProvider.class).in(Scopes.SINGLETON);
 bind(DiscoveryService.class).to(ZKDiscoveryService.class);
 bind(DiscoveryServiceClient.class).to(ProgramDiscoveryServiceClient.class).in(Scopes.SINGLETON);
 expose(DiscoveryService.class);
 expose(DiscoveryServiceClient.class);
}

代码示例来源:origin: cdapio/cdap

@VisibleForTesting
 static Injector createInjector(CConfiguration cConf, Configuration hConf) {
  return Guice.createInjector(
   new ConfigModule(cConf, hConf),
   new ZKClientModule(),
   new ZKDiscoveryModule(),
   new IOModule(),
   new KafkaClientModule(),
   new DFSLocationModule()
  );
 }
}

代码示例来源:origin: cdapio/cdap

new ZKClientModule(),
new KafkaClientModule(),
new ZKDiscoveryModule(),
new MessagingClientModule(),
new AbstractModule() {

代码示例来源:origin: cdapio/cdap

static Injector createGuiceInjector(CConfiguration cConf) {
  return Guice.createInjector(
   new ConfigModule(cConf),
   new ZKClientModule(),
   new ZKDiscoveryModule(),
   new RouterModules().getDistributedModules(),
   new SecurityModules().getDistributedModules(),
   new IOModule(),
   new AbstractModule() {
    @Override
    protected void configure() {
     bind(RouteStore.class).to(ZKRouteStore.class).in(Scopes.SINGLETON);
    }
   }
  );
 }
}

代码示例来源:origin: cdapio/cdap

modules.add(new IOModule());
modules.add(new ZKClientModule());
modules.add(new ZKDiscoveryModule());
modules.add(new MetricsClientRuntimeModule().getDistributedModules());
modules.add(new MessagingClientModule());

代码示例来源:origin: cdapio/cdap

@VisibleForTesting
 public static Injector createInjector(CConfiguration cConf, Configuration hConf) {
  return Guice.createInjector(
   new ConfigModule(cConf, hConf),
   new IOModule(),
   new ZKClientModule(),
   new ZKDiscoveryModule(),
   new KafkaClientModule(),
   new MetricsClientRuntimeModule().getDistributedModules(),
   new KafkaLogAppenderModule(),
   new DFSLocationModule(),
   new NamespaceQueryAdminModule(),
   new AuthorizationEnforcementModule().getDistributedModules(),
   new AuthenticationContextModules().getMasterModule(),
   new MessagingServerRuntimeModule().getDistributedModules()
  );
 }
}

代码示例来源:origin: caskdata/cdap

new ConfigModule(cConf),
new ZKClientModule(),
new ZKDiscoveryModule(),
new DFSLocationModule(),
new AbstractModule() {

代码示例来源:origin: cdapio/cdap

@VisibleForTesting
public static Injector createInjector(CConfiguration cConf, Configuration hConf) {
 return Guice.createInjector(
  new ConfigModule(cConf, hConf),
  new IOModule(),
  new ZKClientModule(),
  new ZKDiscoveryModule(),
  new KafkaClientModule(),
  new DFSLocationModule(),
  new DataFabricModules(HBaseTableExporter.class.getName()).getDistributedModules(),
  new DataSetsModules().getDistributedModules(),
  new MessagingClientModule(),
  new MetricsClientRuntimeModule().getDistributedModules(),
  new KafkaLogAppenderModule(),
  new ExploreClientModule(),
  new AuthorizationModule(),
  new AuthorizationEnforcementModule().getMasterModule(),
  new AuthenticationContextModules().getMasterModule(),
  new NamespaceQueryAdminModule(),
  new SecureStoreServerModule(),
  new AbstractModule() {
   @Override
   protected void configure() {
    bind(UGIProvider.class).to(RemoteUGIProvider.class);
    bind(OwnerAdmin.class).to(DefaultOwnerAdmin.class);
   }
  }
 );
}

代码示例来源:origin: cdapio/cdap

@VisibleForTesting
static Injector createInjector(CConfiguration cConf, Configuration hConf) {
 return Guice.createInjector(
  new ConfigModule(cConf, hConf),
  new ZKClientModule(),
  new DFSLocationModule(),
  new NamespaceQueryAdminModule(),
  new ZKDiscoveryModule(),
  new DataFabricModules("cdap.explore.ContextManager").getDistributedModules(),
  new DataSetsModules().getDistributedModules(),
  new ExploreClientModule(),
  new KafkaClientModule(),
  new AuditModule().getDistributedModules(),
  new AuthorizationEnforcementModule().getDistributedModules(),
  new SecureStoreClientModule(),
  new AuthenticationContextModules().getMasterModule(),
  new MessagingClientModule(),
  new AbstractModule() {
   @Override
   protected void configure() {
    bind(UGIProvider.class).to(RemoteUGIProvider.class).in(Scopes.SINGLETON);
    bind(MetricsCollectionService.class).to(NoOpMetricsCollectionService.class).in(Scopes.SINGLETON);
    // bind PrivilegesManager to a remote implementation, so it does not need to instantiate the authorizer
    bind(PrivilegesManager.class).to(RemotePrivilegesManager.class);
    bind(OwnerAdmin.class).to(DefaultOwnerAdmin.class);
   }
  }
 );
}

代码示例来源:origin: cdapio/cdap

@VisibleForTesting
 static Injector createGuiceInjector(CConfiguration cConf, Configuration hConf, TwillContext twillContext) {
  String txClientId = String.format("cdap.service.%s.%d", Constants.Service.LOGSAVER, twillContext.getInstanceId());
  return Guice.createInjector(
   new ConfigModule(cConf, hConf),
   new IOModule(),
   new ZKClientModule(),
   new ZKDiscoveryModule(),
   new KafkaClientModule(),
   new MetricsClientRuntimeModule().getDistributedModules(),
   new DFSLocationModule(),
   new NamespaceQueryAdminModule(),
   new DataFabricModules(txClientId).getDistributedModules(),
   new DataSetsModules().getDistributedModules(),
   new DistributedLogFrameworkModule(twillContext),
   new KafkaLogAppenderModule(),
   new AuditModule().getDistributedModules(),
   new AuthorizationEnforcementModule().getDistributedModules(),
   new AuthenticationContextModules().getMasterModule(),
   new MessagingClientModule(),
   new AbstractModule() {
    @Override
    protected void configure() {
     bind(OwnerAdmin.class).to(DefaultOwnerAdmin.class);
     bind(UGIProvider.class).to(RemoteUGIProvider.class).in(Scopes.SINGLETON);
    }
   }
  );
 }
}

代码示例来源:origin: cdapio/cdap

@BeforeClass
public static void setup() throws Exception {
 HBaseTestingUtility testUtil = new HBaseTestingUtility();
 zkCluster = testUtil.startMiniZKCluster();
 String zkConnectString = testUtil.getConfiguration().get(HConstants.ZOOKEEPER_QUORUM) + ":"
  + zkCluster.getClientPort();
 LOG.info("Running ZK cluster at " + zkConnectString);
 CConfiguration cConf1 = CConfiguration.create();
 cConf1.set(Constants.Zookeeper.QUORUM, zkConnectString);
 CConfiguration cConf2 = CConfiguration.create();
 cConf2.set(Constants.Zookeeper.QUORUM, zkConnectString);
 injector1 = Guice.createInjector(new ConfigModule(cConf1, testUtil.getConfiguration()), new IOModule(),
                  new SecurityModules().getDistributedModules(), new ZKClientModule(),
                  new ZKDiscoveryModule());
 injector2 = Guice.createInjector(new ConfigModule(cConf2, testUtil.getConfiguration()), new IOModule(),
                  new SecurityModules().getDistributedModules(), new ZKClientModule(),
                  new ZKDiscoveryModule());
}

代码示例来源:origin: cdapio/cdap

@Test
public void testMasterDiscovery() {
 Injector injector = Guice.createInjector(
  new ConfigModule(cConf),
  new ZKClientModule(),
  new ZKDiscoveryModule()
 );
 ZKClientService zkClient = injector.getInstance(ZKClientService.class);
 zkClient.startAndWait();
 try {
  DiscoveryService discoveryService = injector.getInstance(DiscoveryService.class);
  DiscoveryServiceClient discoveryServiceClient = injector.getInstance(DiscoveryServiceClient.class);
  // Register a master service
  InetSocketAddress socketAddr = new InetSocketAddress(InetAddress.getLoopbackAddress(), 43210);
  Cancellable cancellable = discoveryService.register(new Discoverable(Constants.Service.APP_FABRIC_HTTP,
                                     socketAddr));
  try {
   // Discover the master service
   Discoverable discoverable = new RandomEndpointStrategy(
    () -> discoveryServiceClient.discover(Constants.Service.APP_FABRIC_HTTP)).pick(10, TimeUnit.SECONDS);
   Assert.assertNotNull(discoverable);
   Assert.assertEquals(Constants.Service.APP_FABRIC_HTTP, discoverable.getName());
   Assert.assertEquals(socketAddr, discoverable.getSocketAddress());
  } finally {
   cancellable.cancel();
  }
 } finally {
  zkClient.stopAndWait();
 }
}

代码示例来源:origin: cdapio/cdap

new IOModule(),
new ZKClientModule(),
new ZKDiscoveryModule(),
new DFSLocationModule(),
new TwillModule(),

代码示例来源:origin: cdapio/cdap

@VisibleForTesting
static Injector createGuiceInjector(CConfiguration cConf, Configuration hConf, String txClientId,
                  TwillContext twillContext) {
 return Guice.createInjector(
  new ConfigModule(cConf, hConf),
  new IOModule(),
  new ZKClientModule(),
  new ZKDiscoveryModule(),
  new KafkaClientModule(),
  new MessagingClientModule(),
  new MetricsClientRuntimeModule().getDistributedModules(),
  new MetricsStoreModule(),
  new KafkaLogAppenderModule(),
  new DFSLocationModule(),
  new NamespaceQueryAdminModule(),
  new DataFabricModules(txClientId).getDistributedModules(),
  new DataSetsModules().getDistributedModules(),
  new MetricsProcessorModule(twillContext),
  new MetricsProcessorStatusServiceModule(),
  new AuditModule().getDistributedModules(),
  new AuthorizationEnforcementModule().getDistributedModules(),
  new AuthenticationContextModules().getMasterModule(),
  new AbstractModule() {
   @Override
   protected void configure() {
    bind(OwnerAdmin.class).to(DefaultOwnerAdmin.class);
   }
  }
 );
}

代码示例来源:origin: cdapio/cdap

new IOModule(),
new ZKClientModule(),
new ZKDiscoveryModule(),
new KafkaClientModule(),
new MessagingClientModule(),

代码示例来源:origin: cdapio/cdap

new ConfigModule(cConf),
 new ZKClientModule(),
 new ZKDiscoveryModule()
);

代码示例来源:origin: cdapio/cdap

new IOModule(),
new ZKClientModule(),
new ZKDiscoveryModule(),
new KafkaClientModule(),
new MessagingClientModule(),

代码示例来源:origin: cdapio/cdap

new IOModule(),
new ZKClientModule(),
new ZKDiscoveryModule(),
new KafkaClientModule(),
new MessagingClientModule(),

代码示例来源:origin: cdapio/cdap

new IOModule(),
new ZKClientModule(),
new ZKDiscoveryModule(),
new KafkaClientModule(),
new MessagingClientModule(),

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com