org.apache.twill.discovery.DiscoveryService Java Examples
The following examples show how to use
org.apache.twill.discovery.DiscoveryService.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BasicTwillContext.java From twill with Apache License 2.0 | 6 votes |
public BasicTwillContext(RunId runId, RunId appRunId, InetAddress host, String[] args, String[] appArgs, TwillRunnableSpecification spec, int instanceId, DiscoveryService discoveryService, DiscoveryServiceClient discoveryServiceClient, ZKClient zkClient, int instanceCount, int allowedMemoryMB, int virtualCores) { this.runId = runId; this.appRunId = appRunId; this.host = host; this.args = args; this.appArgs = appArgs; this.spec = spec; this.instanceId = instanceId; this.discoveryService = discoveryService; this.discoveryServiceClient = discoveryServiceClient; this.zkClient = zkClient; this.elections = new ElectionRegistry(zkClient); this.instanceCount = instanceCount; this.allowedMemoryMB = allowedMemoryMB; this.virtualCores = virtualCores; }
Example #2
Source File: TephraTransactionProvider.java From phoenix with Apache License 2.0 | 6 votes |
@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; }
Example #3
Source File: DiscoveryModules.java From phoenix-tephra with Apache License 2.0 | 5 votes |
@Provides @Singleton private DiscoveryService providesDiscoveryService(final ZKClientService zkClient, final ZKDiscoveryService delegate) { return new DiscoveryService() { @Override public Cancellable register(Discoverable discoverable) { if (!zkClient.isRunning()) { zkClient.startAndWait(); } return delegate.register(discoverable); } }; }
Example #4
Source File: TransactionService.java From phoenix-tephra with Apache License 2.0 | 5 votes |
@Inject public TransactionService(Configuration conf, ZKClient zkClient, DiscoveryService discoveryService, Provider<TransactionManager> txManagerProvider) { super(conf, discoveryService, txManagerProvider); this.conf = conf; this.zkClient = zkClient; }
Example #5
Source File: InMemoryTransactionService.java From phoenix-tephra with Apache License 2.0 | 5 votes |
@Inject public InMemoryTransactionService(Configuration conf, DiscoveryService discoveryService, Provider<TransactionManager> txManagerProvider) { this.discoveryService = discoveryService; this.txManagerProvider = txManagerProvider; this.serviceName = conf.get(TxConstants.Service.CFG_DATA_TX_DISCOVERY_SERVICE_NAME, TxConstants.Service.DEFAULT_DATA_TX_DISCOVERY_SERVICE_NAME); address = conf.get(TxConstants.Service.CFG_DATA_TX_BIND_ADDRESS, TxConstants.Service.DEFAULT_DATA_TX_BIND_ADDRESS); port = conf.getInt(TxConstants.Service.CFG_DATA_TX_BIND_PORT, TxConstants.Service.DEFAULT_DATA_TX_BIND_PORT); // Retrieve the number of threads for the service threads = conf.getInt(TxConstants.Service.CFG_DATA_TX_SERVER_THREADS, TxConstants.Service.DEFAULT_DATA_TX_SERVER_THREADS); ioThreads = conf.getInt(TxConstants.Service.CFG_DATA_TX_SERVER_IO_THREADS, TxConstants.Service.DEFAULT_DATA_TX_SERVER_IO_THREADS); maxReadBufferBytes = conf.getInt(TxConstants.Service.CFG_DATA_TX_THRIFT_MAX_READ_BUFFER, TxConstants.Service.DEFAULT_DATA_TX_THRIFT_MAX_READ_BUFFER); LOG.info("Configuring TransactionService" + ", address: " + address + ", port: " + port + ", threads: " + threads + ", io threads: " + ioThreads + ", max read buffer (bytes): " + maxReadBufferBytes); }
Example #6
Source File: DiscoveryModules.java From phoenix-tephra with Apache License 2.0 | 4 votes |
@Override protected void configure() { InMemoryDiscoveryService discovery = IN_MEMORY_DISCOVERY_SERVICE; bind(DiscoveryService.class).toInstance(discovery); bind(DiscoveryServiceClient.class).toInstance(discovery); }
Example #7
Source File: DiscoveryModules.java From phoenix-tephra with Apache License 2.0 | 4 votes |
@Override protected void configure() { expose(DiscoveryService.class); expose(DiscoveryServiceClient.class); }
Example #8
Source File: ThriftTransactionSystemTest.java From phoenix-tephra with Apache License 2.0 | 4 votes |
@Inject public TestTransactionService(Configuration conf, ZKClient zkClient, DiscoveryService discoveryService, Provider<TransactionManager> txManagerProvider) { super(conf, zkClient, discoveryService, txManagerProvider); }