本文整理匯總了Java中com.google.cloud.bigtable.config.BulkOptions類的典型用法代碼示例。如果您正苦於以下問題:Java BulkOptions類的具體用法?Java BulkOptions怎麽用?Java BulkOptions使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
BulkOptions類屬於com.google.cloud.bigtable.config包,在下文中一共展示了BulkOptions類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testWriteWithBigTableOptionsSetsBulkOptionsAndRetryOptions
import com.google.cloud.bigtable.config.BulkOptions; //導入依賴的package包/類
@Test
public void testWriteWithBigTableOptionsSetsBulkOptionsAndRetryOptions() {
final int maxInflightRpcs = 1;
final int initialBackoffMillis = -1;
BigtableOptions.Builder optionsBuilder = BIGTABLE_OPTIONS.toBuilder();
BulkOptions.Builder bulkOptionsBuilder = new BulkOptions.Builder();
bulkOptionsBuilder.setMaxInflightRpcs(maxInflightRpcs);
RetryOptions.Builder retryOptionsBuilder = new RetryOptions.Builder();
retryOptionsBuilder.setInitialBackoffMillis(initialBackoffMillis);
optionsBuilder.setBulkOptions(bulkOptionsBuilder.build())
.setRetryOptions(retryOptionsBuilder.build());
BigtableIO.Write write =
BigtableIO.write().withBigtableOptions(optionsBuilder.build());
BigtableOptions options = write.getBigtableOptions();
assertEquals(true, options.getBulkOptions().useBulkApi());
assertEquals(maxInflightRpcs, options.getBulkOptions().getMaxInflightRpcs());
assertEquals(initialBackoffMillis, options.getRetryOptions().getInitialBackoffMillis());
assertThat(options.getBulkOptions(),
Matchers.equalTo(bulkOptionsBuilder
.setUseBulkApi(true)
.build()));
assertThat(options.getRetryOptions(),
Matchers.equalTo(retryOptionsBuilder.build()));
}
示例2: call
import com.google.cloud.bigtable.config.BulkOptions; //導入依賴的package包/類
@Override
public BigtableConnection call() throws Exception {
final CredentialOptions credentials = this.credentials.build();
final RetryOptions retryOptions = new RetryOptions.Builder()
.addStatusToRetryOn(Status.Code.UNKNOWN)
.setAllowRetriesWithoutTimestamp(true)
.build();
final BulkOptions bulkOptions = batchSize
.map(integer -> new BulkOptions.Builder().setBulkMaxRowKeyCount(integer).build())
.orElseGet(() -> new BulkOptions.Builder().build());
final BigtableOptions options = new BigtableOptions.Builder()
.setProjectId(project)
.setInstanceId(instance)
.setUserAgent(USER_AGENT)
.setDataChannelCount(64)
.setCredentialOptions(credentials)
.setRetryOptions(retryOptions)
.setBulkOptions(bulkOptions)
.build();
final BigtableSession session = new BigtableSession(options);
final BigtableTableAdminClient adminClient =
new BigtableTableTableAdminClientImpl(async, session.getTableAdminClient(), project,
instance);
final BigtableMutator mutator =
new BigtableMutatorImpl(async, session, disableBulkMutations, flushIntervalSeconds);
final BigtableDataClient client =
new BigtableDataClientImpl(async, session, mutator, project, instance);
return new GrpcBigtableConnection(async, project, instance, session, mutator, adminClient,
client);
}