本文整理汇总了Java中com.persistit.Exchange类的典型用法代码示例。如果您正苦于以下问题:Java Exchange类的具体用法?Java Exchange怎么用?Java Exchange使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Exchange类属于com.persistit包,在下文中一共展示了Exchange类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: randomWrite
import com.persistit.Exchange; //导入依赖的package包/类
@Benchmark
@BenchmarkMode(Mode.SingleShotTime)
@Warmup(iterations = WARMUP_ITERATIONS)
@Measurement(iterations = MEASUREMENT_ITERATIONS)
@Fork(FORKS)
public void randomWrite() throws PersistitException {
final Exchange exchange = createTestStore();
for (final ByteIterable key : randomKeys) {
exchange.clear();
for (int i = 0; i < key.getLength(); i++) {
exchange.append(key.getBytesUnsafe()[i]);
}
exchange.getValue().put(key.getBytesUnsafe());
exchange.store();
}
persistit.flush();
}
示例2: randomRead
import com.persistit.Exchange; //导入依赖的package包/类
@Benchmark
@BenchmarkMode(Mode.SingleShotTime)
@Warmup(iterations = WARMUP_ITERATIONS)
@Measurement(iterations = MEASUREMENT_ITERATIONS)
@Fork(FORKS)
public void randomRead(final Blackhole bh) throws PersistitException {
final Exchange exchange = createTestStore();
for (final ByteIterable key : randomKeys) {
exchange.clear();
for (int i = 0; i < key.getLength(); i++) {
exchange.append(key.getBytesUnsafe()[i]);
}
exchange.fetch();
bh.consume(((byte[]) exchange.getValue().get()).length);
}
}
示例3: writeSuccessiveKeys
import com.persistit.Exchange; //导入依赖的package包/类
void writeSuccessiveKeys(@NotNull final Exchange store) throws PersistitException {
for (final ByteIterable key : successiveKeys) {
exchange.clear();
for (int i = 0; i < key.getLength(); i++) {
exchange.append(key.getBytesUnsafe()[i]);
}
exchange.getValue().put(key.getBytesUnsafe());
exchange.store();
}
persistit.flush();
}
示例4: successiveRead
import com.persistit.Exchange; //导入依赖的package包/类
@Benchmark
@BenchmarkMode(Mode.SingleShotTime)
@Warmup(iterations = WARMUP_ITERATIONS)
@Measurement(iterations = MEASUREMENT_ITERATIONS)
@Fork(FORKS)
public void successiveRead(final Blackhole bh) throws PersistitException {
final Exchange exchange = createTestStore();
exchange.clear();
exchange.append(Key.BEFORE);
while (exchange.traverse(Key.GT, true)) {
bh.consume(exchange.getKey().toString().length());
bh.consume(((byte[]) exchange.getValue().get()).length);
}
}
示例5: getExchange
import com.persistit.Exchange; //导入依赖的package包/类
public Exchange getExchange(String treeName, Boolean create) throws StorageException {
synchronized (this) {
Exchange exchange;
try {
assign();
exchange = db.getExchange(VOLUME_NAME, treeName, create);
return exchange;
} catch (PersistitException ex) {
throw new PermanentStorageException(ex);
}
}
}
示例6: createTestStore
import com.persistit.Exchange; //导入依赖的package包/类
Exchange createTestStore() throws PersistitException {
if (exchange == null) {
exchange = persistit.getExchange(volume, "testTokyoCabinet", true);
}
return exchange;
}
示例7: releaseExchange
import com.persistit.Exchange; //导入依赖的package包/类
public void releaseExchange(Exchange exchange) {
//
}