本文整理匯總了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) {
//
}