use of org.apache.pulsar.metadata.api.MetadataStoreException.ContentDeserializationException in project pulsar by apache.
the class MetadataCacheImpl method readValueFromStore.
private CompletableFuture<Optional<CacheGetResult<T>>> readValueFromStore(String path) {
return store.get(path).thenCompose(optRes -> {
if (!optRes.isPresent()) {
return FutureUtils.value(Optional.empty());
}
try {
GetResult res = optRes.get();
T obj = serde.deserialize(path, res.getValue(), res.getStat());
return FutureUtils.value(Optional.of(new CacheGetResult<>(obj, res.getStat())));
} catch (Throwable t) {
return FutureUtils.exception(new ContentDeserializationException("Failed to deserialize payload for key '" + path + "'", t));
}
});
}
use of org.apache.pulsar.metadata.api.MetadataStoreException.ContentDeserializationException in project incubator-pulsar by apache.
the class MetadataCacheImpl method readValueFromStore.
private CompletableFuture<Optional<CacheGetResult<T>>> readValueFromStore(String path) {
return store.get(path).thenCompose(optRes -> {
if (!optRes.isPresent()) {
return FutureUtils.value(Optional.empty());
}
try {
GetResult res = optRes.get();
T obj = serde.deserialize(path, res.getValue(), res.getStat());
return FutureUtils.value(Optional.of(new CacheGetResult<>(obj, res.getStat())));
} catch (Throwable t) {
return FutureUtils.exception(new ContentDeserializationException("Failed to deserialize payload for key '" + path + "'", t));
}
});
}
use of org.apache.pulsar.metadata.api.MetadataStoreException.ContentDeserializationException in project pulsar by yahoo.
the class MetadataCacheImpl method readValueFromStore.
private CompletableFuture<Optional<CacheGetResult<T>>> readValueFromStore(String path) {
return store.get(path).thenCompose(optRes -> {
if (!optRes.isPresent()) {
return FutureUtils.value(Optional.empty());
}
try {
GetResult res = optRes.get();
T obj = serde.deserialize(path, res.getValue(), res.getStat());
return FutureUtils.value(Optional.of(new CacheGetResult<>(obj, res.getStat())));
} catch (Throwable t) {
return FutureUtils.exception(new ContentDeserializationException("Failed to deserialize payload for key '" + path + "'", t));
}
});
}
Aggregations