Skip to content

Commit 0a78a3a

Browse files
committed
fix
1 parent 52e65ca commit 0a78a3a

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

core/src/main/java/org/apache/gravitino/metalake/MetalakeManager.java

+16-14
Original file line numberDiff line numberDiff line change
@@ -188,20 +188,22 @@ public BaseMetalake loadMetalake(NameIdentifier ident) throws NoSuchMetalakeExce
188188
return TreeLockUtils.doWithTreeLock(
189189
ident,
190190
LockType.READ,
191-
() -> {
192-
try {
193-
BaseMetalake baseMetalake = store.get(ident, EntityType.METALAKE, BaseMetalake.class);
194-
baseMetalake = newMetalakeWithResolvedProperties(baseMetalake);
195-
METALAKE_CACHE.put(ident, baseMetalake);
196-
return baseMetalake;
197-
} catch (NoSuchEntityException e) {
198-
LOG.warn("Metalake {} does not exist", ident, e);
199-
throw new NoSuchMetalakeException(METALAKE_DOES_NOT_EXIST_MSG, ident);
200-
} catch (IOException ioe) {
201-
LOG.error("Loading Metalake {} failed due to storage issues", ident, ioe);
202-
throw new RuntimeException(ioe);
203-
}
204-
});
191+
() ->
192+
METALAKE_CACHE.get(
193+
ident,
194+
k -> {
195+
try {
196+
BaseMetalake baseMetalake =
197+
store.get(ident, EntityType.METALAKE, BaseMetalake.class);
198+
return newMetalakeWithResolvedProperties(baseMetalake);
199+
} catch (NoSuchEntityException e) {
200+
LOG.warn("Metalake {} does not exist", ident, e);
201+
throw new NoSuchMetalakeException(METALAKE_DOES_NOT_EXIST_MSG, ident);
202+
} catch (IOException ioe) {
203+
LOG.error("Loading Metalake {} failed due to storage issues", ident, ioe);
204+
throw new RuntimeException(ioe);
205+
}
206+
}));
205207
}
206208

207209
private BaseMetalake newMetalakeWithResolvedProperties(BaseMetalake metalakeEntity) {

0 commit comments

Comments
 (0)