/** * Merge this BatchWriterConfig with another. If config is set in both, preference will be given * to this config. * * @param other * Another BatchWriterConfig * @return Merged BatchWriterConfig * @since 2.0.0 */ public BatchWriterConfig merge(BatchWriterConfig other) { BatchWriterConfig result = new BatchWriterConfig(); result.maxMemory = merge(this.maxMemory, other.maxMemory); result.maxLatency = merge(this.maxLatency, other.maxLatency); result.timeout = merge(this.timeout, other.timeout); result.maxWriteThreads = merge(this.maxWriteThreads, other.maxWriteThreads); if (this.isDurabilitySet) { result.durability = this.durability; } else if (other.isDurabilitySet) { result.durability = other.durability; } return result; }
@Override public BatchDeleter createBatchDeleter(String tableName, Authorizations authorizations, int numQueryThreads, BatchWriterConfig config) throws TableNotFoundException { checkArgument(tableName != null, "tableName is null"); checkArgument(authorizations != null, "authorizations is null"); ensureOpen(); return new TabletServerBatchDeleter(this, getTableId(tableName), authorizations, numQueryThreads, config.merge(getBatchWriterConfig())); }
@Override public MultiTableBatchWriter createMultiTableBatchWriter(BatchWriterConfig config) { ensureOpen(); return new MultiTableBatchWriterImpl(this, config.merge(getBatchWriterConfig())); }
@Override public BatchWriter createBatchWriter(String tableName, BatchWriterConfig config) throws TableNotFoundException { checkArgument(tableName != null, "tableName is null"); ensureOpen(); // we used to allow null inputs for bw config if (config == null) { config = new BatchWriterConfig(); } return new BatchWriterImpl(this, getTableId(tableName), config.merge(getBatchWriterConfig())); }