diff --git a/core/src/main/java/google/registry/model/ofy/DatastoreTransactionManager.java b/core/src/main/java/google/registry/model/ofy/DatastoreTransactionManager.java index 1d92290c2..772506997 100644 --- a/core/src/main/java/google/registry/model/ofy/DatastoreTransactionManager.java +++ b/core/src/main/java/google/registry/model/ofy/DatastoreTransactionManager.java @@ -298,6 +298,11 @@ public class DatastoreTransactionManager implements TransactionManager { getOfy().clearSessionCache(); } + @Override + public boolean isOfy() { + return true; + } + /** * Executes the given {@link Result} instance synchronously if not in a transaction. * diff --git a/core/src/main/java/google/registry/persistence/transaction/JpaTransactionManagerImpl.java b/core/src/main/java/google/registry/persistence/transaction/JpaTransactionManagerImpl.java index 8a622e77a..83f49ba4e 100644 --- a/core/src/main/java/google/registry/persistence/transaction/JpaTransactionManagerImpl.java +++ b/core/src/main/java/google/registry/persistence/transaction/JpaTransactionManagerImpl.java @@ -531,6 +531,11 @@ public class JpaTransactionManagerImpl implements JpaTransactionManager { // This is an intended no-op method as there is no session cache in Postgresql. } + @Override + public boolean isOfy() { + return false; + } + @Override public void assertDelete(VKey key) { if (internalDelete(key) != 1) { diff --git a/core/src/main/java/google/registry/persistence/transaction/TransactionManager.java b/core/src/main/java/google/registry/persistence/transaction/TransactionManager.java index 3d705e3fa..1cfc1642a 100644 --- a/core/src/main/java/google/registry/persistence/transaction/TransactionManager.java +++ b/core/src/main/java/google/registry/persistence/transaction/TransactionManager.java @@ -17,7 +17,6 @@ package google.registry.persistence.transaction; import com.google.common.collect.ImmutableCollection; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import google.registry.model.ofy.DatastoreTransactionManager; import google.registry.persistence.VKey; import java.util.NoSuchElementException; import java.util.Optional; @@ -130,7 +129,7 @@ public interface TransactionManager { void putAll(ImmutableCollection entities); /** - * Persists a new entity or update the existing entity in the database without writing any backup + * Persists a new entity or update the existing entity in the database without writing commit logs * if the underlying database is Datastore. * *

This method is for the sake of keeping a single code path when replacing ofy() with tm() in @@ -142,8 +141,8 @@ public interface TransactionManager { void putWithoutBackup(Object entity); /** - * Persists all new entities or update the existing entities in the database without writing any - * backup if the underlying database is Datastore. + * Persists all new entities or update the existing entities in the database without writing + * commit logs if the underlying database is Datastore. * *

This method is for the sake of keeping a single code path when replacing ofy() with tm() in * the application code. When the method is invoked with Datastore, it won't write the commit log @@ -160,7 +159,7 @@ public interface TransactionManager { void updateAll(ImmutableCollection entities); /** - * Updates an entity in the database without writing any backup if the underlying database is + * Updates an entity in the database without writing commit logs if the underlying database is * Datastore. * *

This method is for the sake of keeping a single code path when replacing ofy() with tm() in @@ -254,19 +253,19 @@ public interface TransactionManager { void delete(Object entity); /** - * Deletes the entity by its id without writing any backup if the underlying database is + * Deletes the entity by its id without writing commit logs if the underlying database is * Datastore. */ void deleteWithoutBackup(VKey key); /** - * Deletes the set of entities by their key id without writing any backup if the underlying + * Deletes the set of entities by their key id without writing commit logs if the underlying * database is Datastore. */ void deleteWithoutBackup(Iterable> keys); /** - * Deletes the given entity from the database without writing any backup if the underlying + * Deletes the given entity from the database without writing commit logs if the underlying * database is Datastore. */ void deleteWithoutBackup(Object entity); @@ -274,8 +273,6 @@ public interface TransactionManager { /** Clears the session cache if the underlying database is Datastore, otherwise it is a no-op. */ void clearSessionCache(); - /** Returns true if the transaction manager is DatastoreTransactionManager. */ - default boolean isOfy() { - return this instanceof DatastoreTransactionManager; - } + /** Returns true if the transaction manager is DatastoreTransactionManager, false otherwise. */ + boolean isOfy(); }