gpt4 book ai didi

co.cask.cdap.common.guice.ZKClientModule.()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 02:20:49 28 4
gpt4 key购买 nike

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

ZKClientModule.<init>介绍

暂无

代码示例

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

/**
 * Creates a guice {@link Injector} used by this master service process.
 */
@VisibleForTesting
static Injector createProcessInjector(CConfiguration cConf, Configuration hConf) {
 return Guice.createInjector(
  new ConfigModule(cConf, hConf),
  new ZKClientModule(),
  new KafkaLogAppenderModule()
 );
}

代码示例来源: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: 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: caskdata/cdap

private Injector createInjector() {
 List<Module> modules = ImmutableList.<Module>builder()
  .add(new ConfigModule(cConf))
  .add(new ZKClientModule())
  .add(new KafkaClientModule())
  .addAll(extraModules)
  .build();
 return Guice.createInjector(modules);
}

代码示例来源: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

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

代码示例来源: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 ZKClientModule(),
new ZKDiscoveryModule(),
new DFSLocationModule(),

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

@BeforeClass
public static void init() throws IOException {
 zkServer = InMemoryZKServer.builder().setDataDir(TMP_FOLDER.newFolder()).build();
 zkServer.startAndWait();
 CConfiguration cConf = CConfiguration.create();
 cConf.set(Constants.Zookeeper.QUORUM, zkServer.getConnectionStr());
 Injector injector = Guice.createInjector(new ConfigModule(cConf),
                      new ZKClientModule());
 zkClientService = injector.getInstance(ZKClientService.class);
 zkClientService.startAndWait();
}

代码示例来源: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

@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

Injector injector = Guice.createInjector(
 new ConfigModule(cConf),
 new ZKClientModule(),
 new ZKDiscoveryModule()
);

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

new ConfigModule(cConf, hConf),
new IOModule(),
new ZKClientModule(),
new ZKDiscoveryModule(),
new KafkaClientModule(),

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

new ConfigModule(cConf, hConf),
new IOModule(),
new ZKClientModule(),
new ZKDiscoveryModule(),
new KafkaClientModule(),

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

new ConfigModule(cConf, hConf),
new IOModule(),
new ZKClientModule(),
new ZKDiscoveryModule(),
new KafkaClientModule(),

代码示例来源:origin: co.cask.cdap/cdap-explore

return Guice.createInjector(
 new ConfigModule(cConf, hConf),
 new ZKClientModule(),
 new LocationRuntimeModule().getDistributedModules(),
 new NamespaceClientRuntimeModule().getDistributedModules(),

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