This is an automated email from the ASF dual-hosted git repository.

dimas pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/polaris.git


The following commit(s) were added to refs/heads/main by this push:
     new ca85339de Rework getOrCreateSessionSupplier (#2161)
ca85339de is described below

commit ca85339deee9645f0682194141ae8445ab3af768
Author: Christopher Lambert <xn...@gmx.de>
AuthorDate: Thu Jul 24 16:01:11 2025 +0200

    Rework getOrCreateSessionSupplier (#2161)
    
    note how all the caller immediately called `get` on the returned `Supplier`.
    it seems like the `Supplier` was an leaking implementation detail of the
    `MetaStoreManagerFactor` implementations.
---
 .../persistence/relational/jdbc/JdbcMetaStoreManagerFactory.java  | 7 +++----
 .../core/persistence/LocalPolarisMetaStoreManagerFactory.java     | 7 +++----
 .../apache/polaris/core/persistence/MetaStoreManagerFactory.java  | 3 +--
 .../apache/polaris/service/quarkus/config/QuarkusProducers.java   | 5 ++---
 .../polaris/service/quarkus/admin/ManagementServiceTest.java      | 7 ++-----
 .../polaris/service/quarkus/admin/PolarisAuthzTestBase.java       | 2 +-
 .../service/quarkus/catalog/AbstractIcebergCatalogTest.java       | 2 +-
 .../service/quarkus/catalog/AbstractIcebergCatalogViewTest.java   | 2 +-
 .../quarkus/catalog/AbstractPolarisGenericTableCatalogTest.java   | 2 +-
 .../service/quarkus/catalog/AbstractPolicyCatalogTest.java        | 2 +-
 .../apache/polaris/service/quarkus/entity/CatalogEntityTest.java  | 2 +-
 .../service/quarkus/task/BatchFileCleanupTaskHandlerTest.java     | 6 +++---
 .../service/quarkus/task/ManifestFileCleanupTaskHandlerTest.java  | 8 ++++----
 .../polaris/service/quarkus/task/TableCleanupTaskHandlerTest.java | 2 +-
 .../service/quarkus/test/PolarisIntegrationTestFixture.java       | 2 +-
 .../polaris/service/context/DefaultCallContextResolver.java       | 3 +--
 .../persistence/InMemoryPolarisMetaStoreManagerFactory.java       | 6 ++----
 .../org/apache/polaris/service/catalog/io/FileIOFactoryTest.java  | 2 +-
 .../org/apache/polaris/service/task/TaskExecutorImplTest.java     | 2 +-
 .../java/org/apache/polaris/service/TestServices.java             | 3 +--
 20 files changed, 32 insertions(+), 43 deletions(-)

diff --git 
a/persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/JdbcMetaStoreManagerFactory.java
 
b/persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/JdbcMetaStoreManagerFactory.java
index a6066895c..86652b051 100644
--- 
a/persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/JdbcMetaStoreManagerFactory.java
+++ 
b/persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/JdbcMetaStoreManagerFactory.java
@@ -175,7 +175,7 @@ public class JdbcMetaStoreManagerFactory implements 
MetaStoreManagerFactory {
     for (String realm : realms) {
       RealmContext realmContext = () -> realm;
       PolarisMetaStoreManager metaStoreManager = 
getOrCreateMetaStoreManager(realmContext);
-      BasePersistence session = getOrCreateSessionSupplier(realmContext).get();
+      BasePersistence session = getOrCreateSession(realmContext);
 
       PolarisCallContext callContext = new PolarisCallContext(realmContext, 
session, diagServices);
       BaseResult result = metaStoreManager.purge(callContext);
@@ -200,14 +200,13 @@ public class JdbcMetaStoreManagerFactory implements 
MetaStoreManagerFactory {
   }
 
   @Override
-  public synchronized Supplier<BasePersistence> getOrCreateSessionSupplier(
-      RealmContext realmContext) {
+  public synchronized BasePersistence getOrCreateSession(RealmContext 
realmContext) {
     if (!sessionSupplierMap.containsKey(realmContext.getRealmIdentifier())) {
       DatasourceOperations datasourceOperations = getDatasourceOperations();
       initializeForRealm(datasourceOperations, realmContext, null);
     }
     checkPolarisServiceBootstrappedForRealm(realmContext);
-    return sessionSupplierMap.get(realmContext.getRealmIdentifier());
+    return sessionSupplierMap.get(realmContext.getRealmIdentifier()).get();
   }
 
   @Override
diff --git 
a/polaris-core/src/main/java/org/apache/polaris/core/persistence/LocalPolarisMetaStoreManagerFactory.java
 
b/polaris-core/src/main/java/org/apache/polaris/core/persistence/LocalPolarisMetaStoreManagerFactory.java
index 47aced248..a5141224c 100644
--- 
a/polaris-core/src/main/java/org/apache/polaris/core/persistence/LocalPolarisMetaStoreManagerFactory.java
+++ 
b/polaris-core/src/main/java/org/apache/polaris/core/persistence/LocalPolarisMetaStoreManagerFactory.java
@@ -130,7 +130,7 @@ public abstract class 
LocalPolarisMetaStoreManagerFactory<StoreType>
     for (String realm : realms) {
       RealmContext realmContext = () -> realm;
       PolarisMetaStoreManager metaStoreManager = 
getOrCreateMetaStoreManager(realmContext);
-      TransactionalPersistence session = 
getOrCreateSessionSupplier(realmContext).get();
+      TransactionalPersistence session = getOrCreateSession(realmContext);
 
       PolarisCallContext callContext = new PolarisCallContext(realmContext, 
session, diagServices);
       BaseResult result = metaStoreManager.purge(callContext);
@@ -155,13 +155,12 @@ public abstract class 
LocalPolarisMetaStoreManagerFactory<StoreType>
   }
 
   @Override
-  public synchronized Supplier<TransactionalPersistence> 
getOrCreateSessionSupplier(
-      RealmContext realmContext) {
+  public synchronized TransactionalPersistence getOrCreateSession(RealmContext 
realmContext) {
     if (!sessionSupplierMap.containsKey(realmContext.getRealmIdentifier())) {
       initializeForRealm(realmContext, null);
     }
     checkPolarisServiceBootstrappedForRealm(realmContext);
-    return sessionSupplierMap.get(realmContext.getRealmIdentifier());
+    return sessionSupplierMap.get(realmContext.getRealmIdentifier()).get();
   }
 
   @Override
diff --git 
a/polaris-core/src/main/java/org/apache/polaris/core/persistence/MetaStoreManagerFactory.java
 
b/polaris-core/src/main/java/org/apache/polaris/core/persistence/MetaStoreManagerFactory.java
index c9f14cd8e..4a32a8859 100644
--- 
a/polaris-core/src/main/java/org/apache/polaris/core/persistence/MetaStoreManagerFactory.java
+++ 
b/polaris-core/src/main/java/org/apache/polaris/core/persistence/MetaStoreManagerFactory.java
@@ -19,7 +19,6 @@
 package org.apache.polaris.core.persistence;
 
 import java.util.Map;
-import java.util.function.Supplier;
 import org.apache.polaris.core.config.RealmConfig;
 import org.apache.polaris.core.context.RealmContext;
 import org.apache.polaris.core.persistence.bootstrap.BootstrapOptions;
@@ -33,7 +32,7 @@ public interface MetaStoreManagerFactory {
 
   PolarisMetaStoreManager getOrCreateMetaStoreManager(RealmContext 
realmContext);
 
-  Supplier<? extends BasePersistence> getOrCreateSessionSupplier(RealmContext 
realmContext);
+  BasePersistence getOrCreateSession(RealmContext realmContext);
 
   EntityCache getOrCreateEntityCache(RealmContext realmContext, RealmConfig 
realmConfig);
 
diff --git 
a/runtime/service/src/main/java/org/apache/polaris/service/quarkus/config/QuarkusProducers.java
 
b/runtime/service/src/main/java/org/apache/polaris/service/quarkus/config/QuarkusProducers.java
index 06f4b66bb..8b75bfc89 100644
--- 
a/runtime/service/src/main/java/org/apache/polaris/service/quarkus/config/QuarkusProducers.java
+++ 
b/runtime/service/src/main/java/org/apache/polaris/service/quarkus/config/QuarkusProducers.java
@@ -155,8 +155,7 @@ public class QuarkusProducers {
       PolarisConfigurationStore configurationStore,
       MetaStoreManagerFactory metaStoreManagerFactory,
       Clock clock) {
-    BasePersistence metaStoreSession =
-        metaStoreManagerFactory.getOrCreateSessionSupplier(realmContext).get();
+    BasePersistence metaStoreSession = 
metaStoreManagerFactory.getOrCreateSession(realmContext);
     return new PolarisCallContext(
         realmContext, metaStoreSession, diagServices, configurationStore, 
clock);
   }
@@ -384,7 +383,7 @@ public class QuarkusProducers {
   @RequestScoped
   public BasePersistence polarisMetaStoreSession(
       RealmContext realmContext, MetaStoreManagerFactory 
metaStoreManagerFactory) {
-    return 
metaStoreManagerFactory.getOrCreateSessionSupplier(realmContext).get();
+    return metaStoreManagerFactory.getOrCreateSession(realmContext);
   }
 
   @Produces
diff --git 
a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/admin/ManagementServiceTest.java
 
b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/admin/ManagementServiceTest.java
index 319a0e354..94af5c9c7 100644
--- 
a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/admin/ManagementServiceTest.java
+++ 
b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/admin/ManagementServiceTest.java
@@ -79,10 +79,7 @@ public class ManagementServiceTest {
     PolarisCallContext polarisCallContext =
         new PolarisCallContext(
             fakeServices.realmContext(),
-            fakeServices
-                .metaStoreManagerFactory()
-                .getOrCreateSessionSupplier(fakeServices.realmContext())
-                .get(),
+            
fakeServices.metaStoreManagerFactory().getOrCreateSession(fakeServices.realmContext()),
             fakeServices.polarisDiagnostics(),
             fakeServices.configurationStore(),
             Mockito.mock(Clock.class));
@@ -197,7 +194,7 @@ public class ManagementServiceTest {
     RealmContext realmContext = services.realmContext();
     return new PolarisCallContext(
         realmContext,
-        metaStoreManagerFactory.getOrCreateSessionSupplier(realmContext).get(),
+        metaStoreManagerFactory.getOrCreateSession(realmContext),
         services.polarisDiagnostics());
   }
 
diff --git 
a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/admin/PolarisAuthzTestBase.java
 
b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/admin/PolarisAuthzTestBase.java
index 211c0ae45..d1cd11619 100644
--- 
a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/admin/PolarisAuthzTestBase.java
+++ 
b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/admin/PolarisAuthzTestBase.java
@@ -236,7 +236,7 @@ public abstract class PolarisAuthzTestBase {
     polarisContext =
         new PolarisCallContext(
             realmContext,
-            managerFactory.getOrCreateSessionSupplier(realmContext).get(),
+            managerFactory.getOrCreateSession(realmContext),
             diagServices,
             configurationStore,
             clock);
diff --git 
a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractIcebergCatalogTest.java
 
b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractIcebergCatalogTest.java
index 3a991d755..4b60434d8 100644
--- 
a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractIcebergCatalogTest.java
+++ 
b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractIcebergCatalogTest.java
@@ -277,7 +277,7 @@ public abstract class AbstractIcebergCatalogTest extends 
CatalogTests<IcebergCat
     polarisContext =
         new PolarisCallContext(
             realmContext,
-            
metaStoreManagerFactory.getOrCreateSessionSupplier(realmContext).get(),
+            metaStoreManagerFactory.getOrCreateSession(realmContext),
             diagServices,
             configurationStore,
             Clock.systemDefaultZone());
diff --git 
a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractIcebergCatalogViewTest.java
 
b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractIcebergCatalogViewTest.java
index 08b426c77..ddcd71fb4 100644
--- 
a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractIcebergCatalogViewTest.java
+++ 
b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractIcebergCatalogViewTest.java
@@ -162,7 +162,7 @@ public abstract class AbstractIcebergCatalogViewTest 
extends ViewCatalogTests<Ic
     polarisContext =
         new PolarisCallContext(
             realmContext,
-            
metaStoreManagerFactory.getOrCreateSessionSupplier(realmContext).get(),
+            metaStoreManagerFactory.getOrCreateSession(realmContext),
             diagServices,
             configurationStore,
             Clock.systemDefaultZone());
diff --git 
a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractPolarisGenericTableCatalogTest.java
 
b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractPolarisGenericTableCatalogTest.java
index 959a542ca..49d8659b3 100644
--- 
a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractPolarisGenericTableCatalogTest.java
+++ 
b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractPolarisGenericTableCatalogTest.java
@@ -153,7 +153,7 @@ public abstract class 
AbstractPolarisGenericTableCatalogTest {
     polarisContext =
         new PolarisCallContext(
             realmContext,
-            
metaStoreManagerFactory.getOrCreateSessionSupplier(realmContext).get(),
+            metaStoreManagerFactory.getOrCreateSession(realmContext),
             diagServices,
             configurationStore,
             Clock.systemDefaultZone());
diff --git 
a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractPolicyCatalogTest.java
 
b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractPolicyCatalogTest.java
index 68dc6d3f9..e936903ba 100644
--- 
a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractPolicyCatalogTest.java
+++ 
b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractPolicyCatalogTest.java
@@ -176,7 +176,7 @@ public abstract class AbstractPolicyCatalogTest {
     polarisContext =
         new PolarisCallContext(
             realmContext,
-            
metaStoreManagerFactory.getOrCreateSessionSupplier(realmContext).get(),
+            metaStoreManagerFactory.getOrCreateSession(realmContext),
             diagServices,
             configurationStore,
             Clock.systemDefaultZone());
diff --git 
a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/entity/CatalogEntityTest.java
 
b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/entity/CatalogEntityTest.java
index 1b5c8ed23..fed6e3e20 100644
--- 
a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/entity/CatalogEntityTest.java
+++ 
b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/entity/CatalogEntityTest.java
@@ -58,7 +58,7 @@ public class CatalogEntityTest {
     PolarisCallContext polarisCallContext =
         new PolarisCallContext(
             realmContext,
-            metaStoreManagerFactory.getOrCreateSessionSupplier(() -> 
"realm").get(),
+            metaStoreManagerFactory.getOrCreateSession(realmContext),
             new PolarisDefaultDiagServiceImpl());
     this.callContext = polarisCallContext;
     CallContext.setCurrentContext(polarisCallContext);
diff --git 
a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/task/BatchFileCleanupTaskHandlerTest.java
 
b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/task/BatchFileCleanupTaskHandlerTest.java
index 37162b5df..9a3269138 100644
--- 
a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/task/BatchFileCleanupTaskHandlerTest.java
+++ 
b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/task/BatchFileCleanupTaskHandlerTest.java
@@ -69,7 +69,7 @@ public class BatchFileCleanupTaskHandlerTest {
     PolarisCallContext polarisCallContext =
         new PolarisCallContext(
             realmContext,
-            
metaStoreManagerFactory.getOrCreateSessionSupplier(realmContext).get(),
+            metaStoreManagerFactory.getOrCreateSession(realmContext),
             new PolarisDefaultDiagServiceImpl());
     FileIO fileIO =
         new InMemoryFileIO() {
@@ -182,7 +182,7 @@ public class BatchFileCleanupTaskHandlerTest {
     PolarisCallContext polarisCallContext =
         new PolarisCallContext(
             realmContext,
-            
metaStoreManagerFactory.getOrCreateSessionSupplier(realmContext).get(),
+            metaStoreManagerFactory.getOrCreateSession(realmContext),
             new PolarisDefaultDiagServiceImpl());
     CallContext.setCurrentContext(polarisCallContext);
     FileIO fileIO = new InMemoryFileIO();
@@ -227,7 +227,7 @@ public class BatchFileCleanupTaskHandlerTest {
     PolarisCallContext polarisCallContext =
         new PolarisCallContext(
             realmContext,
-            
metaStoreManagerFactory.getOrCreateSessionSupplier(realmContext).get(),
+            metaStoreManagerFactory.getOrCreateSession(realmContext),
             new PolarisDefaultDiagServiceImpl());
     CallContext.setCurrentContext(polarisCallContext);
     Map<String, AtomicInteger> retryCounter = new HashMap<>();
diff --git 
a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/task/ManifestFileCleanupTaskHandlerTest.java
 
b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/task/ManifestFileCleanupTaskHandlerTest.java
index 381dfa8a8..e3afedcb5 100644
--- 
a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/task/ManifestFileCleanupTaskHandlerTest.java
+++ 
b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/task/ManifestFileCleanupTaskHandlerTest.java
@@ -68,7 +68,7 @@ class ManifestFileCleanupTaskHandlerTest {
     PolarisCallContext polarisCallContext =
         new PolarisCallContext(
             realmContext,
-            
metaStoreManagerFactory.getOrCreateSessionSupplier(realmContext).get(),
+            metaStoreManagerFactory.getOrCreateSession(realmContext),
             new PolarisDefaultDiagServiceImpl());
     FileIO fileIO = new InMemoryFileIO();
     TableIdentifier tableIdentifier = TableIdentifier.of(Namespace.of("db1", 
"schema1"), "table1");
@@ -98,7 +98,7 @@ class ManifestFileCleanupTaskHandlerTest {
     PolarisCallContext polarisCallContext =
         new PolarisCallContext(
             realmContext,
-            
metaStoreManagerFactory.getOrCreateSessionSupplier(realmContext).get(),
+            metaStoreManagerFactory.getOrCreateSession(realmContext),
             new PolarisDefaultDiagServiceImpl());
     CallContext.setCurrentContext(polarisCallContext);
     FileIO fileIO = new InMemoryFileIO();
@@ -127,7 +127,7 @@ class ManifestFileCleanupTaskHandlerTest {
     PolarisCallContext polarisCallContext =
         new PolarisCallContext(
             realmContext,
-            
metaStoreManagerFactory.getOrCreateSessionSupplier(realmContext).get(),
+            metaStoreManagerFactory.getOrCreateSession(realmContext),
             new PolarisDefaultDiagServiceImpl());
     CallContext.setCurrentContext(polarisCallContext);
     FileIO fileIO =
@@ -173,7 +173,7 @@ class ManifestFileCleanupTaskHandlerTest {
     PolarisCallContext polarisCallContext =
         new PolarisCallContext(
             realmContext,
-            
metaStoreManagerFactory.getOrCreateSessionSupplier(realmContext).get(),
+            metaStoreManagerFactory.getOrCreateSession(realmContext),
             new PolarisDefaultDiagServiceImpl());
     CallContext.setCurrentContext(polarisCallContext);
     Map<String, AtomicInteger> retryCounter = new HashMap<>();
diff --git 
a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/task/TableCleanupTaskHandlerTest.java
 
b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/task/TableCleanupTaskHandlerTest.java
index 69304956b..854bef674 100644
--- 
a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/task/TableCleanupTaskHandlerTest.java
+++ 
b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/task/TableCleanupTaskHandlerTest.java
@@ -84,7 +84,7 @@ class TableCleanupTaskHandlerTest {
     callContext =
         new PolarisCallContext(
             realmContext,
-            
metaStoreManagerFactory.getOrCreateSessionSupplier(realmContext).get(),
+            metaStoreManagerFactory.getOrCreateSession(realmContext),
             diagServices,
             configurationStore,
             Clock.systemDefaultZone());
diff --git 
a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/test/PolarisIntegrationTestFixture.java
 
b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/test/PolarisIntegrationTestFixture.java
index e9268befb..efb4eb1df 100644
--- 
a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/test/PolarisIntegrationTestFixture.java
+++ 
b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/test/PolarisIntegrationTestFixture.java
@@ -111,7 +111,7 @@ public class PolarisIntegrationTestFixture {
             .join();
 
     BasePersistence metaStoreSession =
-        
helper.metaStoreManagerFactory.getOrCreateSessionSupplier(realmContext).get();
+        helper.metaStoreManagerFactory.getOrCreateSession(realmContext);
     PolarisCallContext polarisContext =
         new PolarisCallContext(
             realmContext,
diff --git 
a/service/common/src/main/java/org/apache/polaris/service/context/DefaultCallContextResolver.java
 
b/service/common/src/main/java/org/apache/polaris/service/context/DefaultCallContextResolver.java
index 62b113dae..f8c95b1ec 100644
--- 
a/service/common/src/main/java/org/apache/polaris/service/context/DefaultCallContextResolver.java
+++ 
b/service/common/src/main/java/org/apache/polaris/service/context/DefaultCallContextResolver.java
@@ -64,8 +64,7 @@ public class DefaultCallContextResolver implements 
CallContextResolver {
     // pushed down for the metaStoreManagerFactory to inject Transactional-DB 
specific things
     // (including the MetaStoreSession" into the PolarisCallContext. The 
non-transactional
     // factories would then inject something else instead if needed.
-    BasePersistence metaStoreSession =
-        metaStoreManagerFactory.getOrCreateSessionSupplier(realmContext).get();
+    BasePersistence metaStoreSession = 
metaStoreManagerFactory.getOrCreateSession(realmContext);
     return new PolarisCallContext(
         realmContext, metaStoreSession, diagnostics, configurationStore, 
clock);
   }
diff --git 
a/service/common/src/main/java/org/apache/polaris/service/persistence/InMemoryPolarisMetaStoreManagerFactory.java
 
b/service/common/src/main/java/org/apache/polaris/service/persistence/InMemoryPolarisMetaStoreManagerFactory.java
index 895e5b51b..0febc2cae 100644
--- 
a/service/common/src/main/java/org/apache/polaris/service/persistence/InMemoryPolarisMetaStoreManagerFactory.java
+++ 
b/service/common/src/main/java/org/apache/polaris/service/persistence/InMemoryPolarisMetaStoreManagerFactory.java
@@ -27,7 +27,6 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.function.Supplier;
 import org.apache.polaris.core.PolarisDiagnostics;
 import org.apache.polaris.core.context.RealmContext;
 import org.apache.polaris.core.persistence.LocalPolarisMetaStoreManagerFactory;
@@ -84,13 +83,12 @@ public class InMemoryPolarisMetaStoreManagerFactory
   }
 
   @Override
-  public synchronized Supplier<TransactionalPersistence> 
getOrCreateSessionSupplier(
-      RealmContext realmContext) {
+  public synchronized TransactionalPersistence getOrCreateSession(RealmContext 
realmContext) {
     String realmId = realmContext.getRealmIdentifier();
     if (!bootstrappedRealms.contains(realmId)) {
       bootstrapRealmsFromEnvironment(List.of(realmId));
     }
-    return super.getOrCreateSessionSupplier(realmContext);
+    return super.getOrCreateSession(realmContext);
   }
 
   private void bootstrapRealmsFromEnvironment(List<String> realms) {
diff --git 
a/service/common/src/test/java/org/apache/polaris/service/catalog/io/FileIOFactoryTest.java
 
b/service/common/src/test/java/org/apache/polaris/service/catalog/io/FileIOFactoryTest.java
index 24fff244b..7e320dbbf 100644
--- 
a/service/common/src/test/java/org/apache/polaris/service/catalog/io/FileIOFactoryTest.java
+++ 
b/service/common/src/test/java/org/apache/polaris/service/catalog/io/FileIOFactoryTest.java
@@ -139,7 +139,7 @@ public class FileIOFactoryTest {
     callContext =
         new PolarisCallContext(
             realmContext,
-            
testServices.metaStoreManagerFactory().getOrCreateSessionSupplier(realmContext).get(),
+            
testServices.metaStoreManagerFactory().getOrCreateSession(realmContext),
             testServices.polarisDiagnostics(),
             testServices.configurationStore(),
             Clock.systemUTC());
diff --git 
a/service/common/src/test/java/org/apache/polaris/service/task/TaskExecutorImplTest.java
 
b/service/common/src/test/java/org/apache/polaris/service/task/TaskExecutorImplTest.java
index c67f7f172..6c4f74b1f 100644
--- 
a/service/common/src/test/java/org/apache/polaris/service/task/TaskExecutorImplTest.java
+++ 
b/service/common/src/test/java/org/apache/polaris/service/task/TaskExecutorImplTest.java
@@ -47,7 +47,7 @@ public class TaskExecutorImplTest {
     MetaStoreManagerFactory metaStoreManagerFactory = 
testServices.metaStoreManagerFactory();
     PolarisMetaStoreManager metaStoreManager =
         metaStoreManagerFactory.getOrCreateMetaStoreManager(realmContext);
-    BasePersistence bp = 
metaStoreManagerFactory.getOrCreateSessionSupplier(realmContext).get();
+    BasePersistence bp = 
metaStoreManagerFactory.getOrCreateSession(realmContext);
 
     PolarisCallContext polarisCallCtx =
         new PolarisCallContext(realmContext, bp, 
testServices.polarisDiagnostics());
diff --git 
a/service/common/src/testFixtures/java/org/apache/polaris/service/TestServices.java
 
b/service/common/src/testFixtures/java/org/apache/polaris/service/TestServices.java
index 081eac40e..a10e78d2b 100644
--- 
a/service/common/src/testFixtures/java/org/apache/polaris/service/TestServices.java
+++ 
b/service/common/src/testFixtures/java/org/apache/polaris/service/TestServices.java
@@ -167,8 +167,7 @@ public record TestServices(
       UserSecretsManagerFactory userSecretsManagerFactory =
           new UnsafeInMemorySecretsManagerFactory();
 
-      BasePersistence metaStoreSession =
-          
metaStoreManagerFactory.getOrCreateSessionSupplier(realmContext).get();
+      BasePersistence metaStoreSession = 
metaStoreManagerFactory.getOrCreateSession(realmContext);
       CallContext callContext =
           new PolarisCallContext(
               realmContext,

Reply via email to