use of org.apache.bookkeeper.common.exceptions.ObjectClosedException in project bookkeeper by apache.
the class MVCCStoreFactoryImpl method newStore.
CompletableFuture<MVCCAsyncStore<byte[], byte[]>> newStore(long scId, long streamId, long rangeId) {
synchronized (this) {
if (closed) {
return FutureUtils.exception(new ObjectClosedException("MVCCStoreFactory"));
}
}
MVCCAsyncStore<byte[], byte[]> store = storeSupplier.get();
File targetDir = chooseLocalStoreDir(streamId);
// used for store ranges
Path rangeStorePath = Paths.get(targetDir.getAbsolutePath(), "ranges", normalizedName(scId), normalizedName(streamId), normalizedName(rangeId));
String storeName = String.format("%s/%s/%s", normalizedName(scId), normalizedName(streamId), normalizedName(rangeId));
// build a spec
StateStoreSpec spec = StateStoreSpec.builder().name(storeName).keyCoder(ByteArrayCoder.of()).valCoder(ByteArrayCoder.of()).localStateStoreDir(rangeStorePath.toFile()).stream(streamName(scId, streamId, rangeId)).writeIOScheduler(chooseWriteIOExecutor(streamId)).readIOScheduler(chooseReadIOExecutor(streamId)).checkpointStore(checkpointStore).checkpointDuration(Duration.ofMinutes(15)).checkpointIOScheduler(chooseCheckpointIOExecutor(streamId)).isReadonly(serveReadOnlyTable).build();
return store.init(spec).thenApply(ignored -> {
addStore(scId, streamId, rangeId, store);
return store;
});
}
Aggregations