juiceyang commented on code in PR #9191:
URL: https://github.com/apache/gravitino/pull/9191#discussion_r2559000562
##########
flink-connector/flink/src/main/java/org/apache/gravitino/flink/connector/catalog/GravitinoCatalogManager.java:
##########
@@ -56,10 +69,20 @@ private GravitinoCatalogManager(
*/
public static GravitinoCatalogManager create(
String gravitinoUri, String metalakeName, Map<String, String>
gravitinoClientConfig) {
- Preconditions.checkState(
- gravitinoCatalogManager == null, "Should not create duplicate
GravitinoCatalogManager");
- gravitinoCatalogManager =
- new GravitinoCatalogManager(gravitinoUri, metalakeName,
gravitinoClientConfig);
+ if (gravitinoCatalogManager == null) {
+ gravitinoCatalogManager =
+ new GravitinoCatalogManager(gravitinoUri, metalakeName,
gravitinoClientConfig);
+ } else {
+ Preconditions.checkState(
+ gravitinoCatalogManager.gravitinoUri.equals(gravitinoUri)
Review Comment:
Method `checkEqual` added.
Since the `checkEqual` method doesn’t know where it’s being called from,
there’s no reason for it to throw an exception when the values don’t match.
Therefore, I kept the Preconditions checks in the `create` method so that a
more specific and meaningful error message can be thrown.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]