mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#2315 - Refactor internals - make more classes final in transaction packages
This commit is contained in:
+1
-2
@@ -8,10 +8,9 @@ import java.util.Map;
|
||||
/**
|
||||
* Determines the properties on a given bean.
|
||||
*/
|
||||
public class BeanPropertiesReader {
|
||||
public final class BeanPropertiesReader {
|
||||
|
||||
private final Map<String, Integer> propertyIndexMap = new HashMap<>();
|
||||
|
||||
private final String[] props;
|
||||
|
||||
public BeanPropertiesReader(Class<?> clazz) {
|
||||
|
||||
@@ -28,12 +28,10 @@ import java.util.List;
|
||||
* size of data sent around the network.
|
||||
* </p>
|
||||
*/
|
||||
public class BeanPersistIds implements BinaryWritable {
|
||||
public final class BeanPersistIds implements BinaryWritable {
|
||||
|
||||
private final BeanDescriptor<?> beanDescriptor;
|
||||
|
||||
private final String descriptorId;
|
||||
|
||||
/**
|
||||
* The ids to invalidate from the cache (updates and deletes).
|
||||
*/
|
||||
|
||||
+2
-4
@@ -8,12 +8,11 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class BulkEventListenerMap {
|
||||
public final class BulkEventListenerMap {
|
||||
|
||||
private final HashMap<String, Entry> map = new HashMap<>();
|
||||
|
||||
public BulkEventListenerMap(List<BulkTableEventListener> listeners) {
|
||||
|
||||
if (listeners != null) {
|
||||
for (BulkTableEventListener l : listeners) {
|
||||
Set<String> tables = l.registeredTables();
|
||||
@@ -29,7 +28,6 @@ public class BulkEventListenerMap {
|
||||
}
|
||||
|
||||
public void process(BulkTableEvent event) {
|
||||
|
||||
Entry entry = map.get(event.getTableName());
|
||||
if (entry != null) {
|
||||
entry.process(event);
|
||||
@@ -42,7 +40,7 @@ public class BulkEventListenerMap {
|
||||
entry.add(l);
|
||||
}
|
||||
|
||||
private static class Entry {
|
||||
private static final class Entry {
|
||||
|
||||
final List<BulkTableEventListener> listeners = new ArrayList<>();
|
||||
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ import static java.time.temporal.ChronoField.YEAR;
|
||||
* <p>
|
||||
* Uses a sleep backoff on the single threaded consumer that reads the profiles and writes them to files.
|
||||
*/
|
||||
public class DefaultProfileHandler implements SpiProfileHandler, Plugin {
|
||||
public final class DefaultProfileHandler implements SpiProfileHandler, Plugin {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(DefaultProfileHandler.class);
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import io.ebean.ProfileLocation;
|
||||
/**
|
||||
* Default transaction profiling event collection.
|
||||
*/
|
||||
public class DefaultProfileStream implements ProfileStream {
|
||||
public final class DefaultProfileStream implements ProfileStream {
|
||||
|
||||
private final long startNanos;
|
||||
private final StringBuilder buffer;
|
||||
|
||||
+5
-6
@@ -9,7 +9,6 @@ import javax.persistence.PersistenceException;
|
||||
*/
|
||||
public class DefaultTransactionScopeManager extends TransactionScopeManager {
|
||||
|
||||
|
||||
private final ThreadLocal<SpiTransaction> local = new ThreadLocal<>();
|
||||
|
||||
@Override
|
||||
@@ -18,7 +17,7 @@ public class DefaultTransactionScopeManager extends TransactionScopeManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpiTransaction getInScope() {
|
||||
public final SpiTransaction getInScope() {
|
||||
return local.get();
|
||||
}
|
||||
|
||||
@@ -33,7 +32,7 @@ public class DefaultTransactionScopeManager extends TransactionScopeManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void replace(SpiTransaction trans) {
|
||||
public final void replace(SpiTransaction trans) {
|
||||
if (trans == null) {
|
||||
throw new IllegalStateException("Setting a null transaction?");
|
||||
}
|
||||
@@ -41,7 +40,7 @@ public class DefaultTransactionScopeManager extends TransactionScopeManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(SpiTransaction trans) {
|
||||
public final void set(SpiTransaction trans) {
|
||||
if (trans == null) {
|
||||
throw new IllegalStateException("Setting a null transaction?");
|
||||
}
|
||||
@@ -50,13 +49,13 @@ public class DefaultTransactionScopeManager extends TransactionScopeManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
public final void clear() {
|
||||
checkForActiveTransaction();
|
||||
local.remove();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearExternal() {
|
||||
public final void clearExternal() {
|
||||
local.remove();
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import java.sql.Connection;
|
||||
/**
|
||||
* Document store only transaction.
|
||||
*/
|
||||
public class DocStoreOnlyTransaction extends JdbcTransaction {
|
||||
public final class DocStoreOnlyTransaction extends JdbcTransaction {
|
||||
|
||||
/**
|
||||
* Create a new DocStore only Transaction.
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import java.sql.Connection;
|
||||
* <p>
|
||||
* There is no underlying JDBC DataSource etc
|
||||
*/
|
||||
public class DocStoreTransactionManager extends TransactionManager {
|
||||
public final class DocStoreTransactionManager extends TransactionManager {
|
||||
|
||||
/**
|
||||
* Create the TransactionManager
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import io.ebeaninternal.api.SpiTransaction;
|
||||
/**
|
||||
* A TransactionScopeManager aware of external transaction managers.
|
||||
*/
|
||||
public class ExternalTransactionScopeManager extends DefaultTransactionScopeManager {
|
||||
public final class ExternalTransactionScopeManager extends DefaultTransactionScopeManager {
|
||||
|
||||
private final ExternalTransactionManager externalManager;
|
||||
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ import java.util.Map;
|
||||
* persisting features are attempted to be used - which is not expected).
|
||||
* </p>
|
||||
*/
|
||||
class ImplicitReadOnlyTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
final class ImplicitReadOnlyTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ImplicitReadOnlyTransaction.class);
|
||||
|
||||
|
||||
@@ -219,56 +219,56 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLabel(String label) {
|
||||
public final void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLabel() {
|
||||
public final String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getStartNanoTime() {
|
||||
public final long getStartNanoTime() {
|
||||
return startNanos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long profileOffset() {
|
||||
public final long profileOffset() {
|
||||
return (profileStream == null) ? 0 : profileStream.offset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void profileEvent(SpiProfileTransactionEvent event) {
|
||||
public final void profileEvent(SpiProfileTransactionEvent event) {
|
||||
if (profileStream != null) {
|
||||
event.profile();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProfileStream(ProfileStream profileStream) {
|
||||
public final void setProfileStream(ProfileStream profileStream) {
|
||||
this.profileStream = profileStream;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProfileStream profileStream() {
|
||||
public final ProfileStream profileStream() {
|
||||
return profileStream;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProfileLocation(ProfileLocation profileLocation) {
|
||||
public final void setProfileLocation(ProfileLocation profileLocation) {
|
||||
this.profileLocation = profileLocation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProfileLocation getProfileLocation() {
|
||||
public final ProfileLocation getProfileLocation() {
|
||||
return profileLocation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden in AutoCommitJdbcTransaction as that expects to run/operate with autocommit true.
|
||||
*/
|
||||
void checkAutoCommit(Connection connection) throws SQLException {
|
||||
final void checkAutoCommit(Connection connection) throws SQLException {
|
||||
if (connection != null) {
|
||||
this.autoCommit = connection.getAutoCommit();
|
||||
if (this.autoCommit) {
|
||||
@@ -289,34 +289,34 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAutoPersistUpdates(boolean autoPersistUpdates) {
|
||||
public final void setAutoPersistUpdates(boolean autoPersistUpdates) {
|
||||
this.autoPersistUpdates = autoPersistUpdates;
|
||||
this.batchMode = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAutoPersistUpdates() {
|
||||
public final boolean isAutoPersistUpdates() {
|
||||
return autoPersistUpdates;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSkipCacheExplicit() {
|
||||
public final boolean isSkipCacheExplicit() {
|
||||
return (skipCache != null && !skipCache);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSkipCache() {
|
||||
public final boolean isSkipCache() {
|
||||
if (skipCache != null) return skipCache;
|
||||
return skipCacheAfterWrite && !queryOnly;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSkipCache(boolean skipCache) {
|
||||
public final void setSkipCache(boolean skipCache) {
|
||||
this.skipCache = skipCache;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLogPrefix() {
|
||||
public final String getLogPrefix() {
|
||||
return logPrefix;
|
||||
}
|
||||
|
||||
@@ -330,7 +330,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBeanChange(BeanChange beanChange) {
|
||||
public final void addBeanChange(BeanChange beanChange) {
|
||||
if (changeLogHolder == null) {
|
||||
changeLogHolder = new TChangeLogHolder(this, 100);
|
||||
}
|
||||
@@ -338,14 +338,14 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendChangeLog(ChangeSet changesRequest) {
|
||||
public final void sendChangeLog(ChangeSet changesRequest) {
|
||||
if (manager != null) {
|
||||
manager.sendChangeLog(changesRequest);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(TransactionCallback callback) {
|
||||
public final void register(TransactionCallback callback) {
|
||||
if (callbackList == null) {
|
||||
callbackList = new ArrayList<>(4);
|
||||
}
|
||||
@@ -391,27 +391,27 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDocStoreBatchSize() {
|
||||
public final int getDocStoreBatchSize() {
|
||||
return docStoreBatchSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDocStoreBatchSize(int docStoreBatchSize) {
|
||||
public final void setDocStoreBatchSize(int docStoreBatchSize) {
|
||||
this.docStoreBatchSize = docStoreBatchSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DocStoreMode getDocStoreMode() {
|
||||
public final DocStoreMode getDocStoreMode() {
|
||||
return docStoreMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDocStoreMode(DocStoreMode docStoreMode) {
|
||||
public final void setDocStoreMode(DocStoreMode docStoreMode) {
|
||||
this.docStoreMode = docStoreMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerDeferred(PersistDeferredRelationship derived) {
|
||||
public final void registerDeferred(PersistDeferredRelationship derived) {
|
||||
if (deferredList == null) {
|
||||
deferredList = new ArrayList<>();
|
||||
}
|
||||
@@ -425,7 +425,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
* </p>
|
||||
*/
|
||||
@Override
|
||||
public void registerDeleteBean(Integer persistingBean) {
|
||||
public final void registerDeleteBean(Integer persistingBean) {
|
||||
if (deletingBeansHash == null) {
|
||||
deletingBeansHash = new HashSet<>();
|
||||
}
|
||||
@@ -436,7 +436,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
* Return true if this is a bean that has already been saved/deleted.
|
||||
*/
|
||||
@Override
|
||||
public boolean isRegisteredDeleteBean(Integer persistingBean) {
|
||||
public final boolean isRegisteredDeleteBean(Integer persistingBean) {
|
||||
return deletingBeansHash != null && deletingBeansHash.contains(persistingBean);
|
||||
}
|
||||
|
||||
@@ -444,7 +444,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
* Unregister the persisted beans (when persisting at the top level).
|
||||
*/
|
||||
@Override
|
||||
public void unregisterBeans() {
|
||||
public final void unregisterBeans() {
|
||||
persistingBeans.clear();
|
||||
}
|
||||
|
||||
@@ -453,7 +453,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
* register the bean if it is not already.
|
||||
*/
|
||||
@Override
|
||||
public boolean isRegisteredBean(Object bean) {
|
||||
public final boolean isRegisteredBean(Object bean) {
|
||||
if (persistingBeans == null) {
|
||||
persistingBeans = new IdentityHashMap<>();
|
||||
}
|
||||
@@ -465,7 +465,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
* This is to stop m2m intersection management via both directions of a m2m.
|
||||
*/
|
||||
@Override
|
||||
public boolean isSaveAssocManyIntersection(String intersectionTable, String beanName) {
|
||||
public final boolean isSaveAssocManyIntersection(String intersectionTable, String beanName) {
|
||||
if (m2mIntersectionSave == null) {
|
||||
// first attempt so yes allow this m2m intersection direction
|
||||
m2mIntersectionSave = new HashMap<>();
|
||||
@@ -500,7 +500,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
* @param diff the amount to add or subtract from the depth.
|
||||
*/
|
||||
@Override
|
||||
public void depth(int diff) {
|
||||
public final void depth(int diff) {
|
||||
depth += diff;
|
||||
}
|
||||
|
||||
@@ -508,12 +508,12 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
* Return the current depth.
|
||||
*/
|
||||
@Override
|
||||
public int depth() {
|
||||
public final int depth() {
|
||||
return depth;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markNotQueryOnly() {
|
||||
public final void markNotQueryOnly() {
|
||||
this.queryOnly = false;
|
||||
}
|
||||
|
||||
@@ -543,17 +543,17 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUpdateAllLoadedProperties(boolean updateAllLoadedProperties) {
|
||||
public final void setUpdateAllLoadedProperties(boolean updateAllLoadedProperties) {
|
||||
this.updateAllLoadedProperties = updateAllLoadedProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean isUpdateAllLoadedProperties() {
|
||||
public final Boolean isUpdateAllLoadedProperties() {
|
||||
return updateAllLoadedProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBatchMode(boolean batchMode) {
|
||||
public final void setBatchMode(boolean batchMode) {
|
||||
if (!isActive()) {
|
||||
throw new IllegalStateException(illegalStateMessage);
|
||||
}
|
||||
@@ -561,12 +561,12 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBatchMode() {
|
||||
public final boolean isBatchMode() {
|
||||
return batchMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBatchOnCascade(boolean batchMode) {
|
||||
public final void setBatchOnCascade(boolean batchMode) {
|
||||
if (!isActive()) {
|
||||
throw new IllegalStateException(illegalStateMessage);
|
||||
}
|
||||
@@ -574,17 +574,17 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBatchOnCascade() {
|
||||
public final boolean isBatchOnCascade() {
|
||||
return batchOnCascadeMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean getBatchGetGeneratedKeys() {
|
||||
public final Boolean getBatchGetGeneratedKeys() {
|
||||
return batchGetGeneratedKeys;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGetGeneratedKeys(boolean getGeneratedKeys) {
|
||||
public final void setGetGeneratedKeys(boolean getGeneratedKeys) {
|
||||
this.batchGetGeneratedKeys = getGeneratedKeys;
|
||||
if (batchControl != null) {
|
||||
batchControl.setGetGeneratedKeys(getGeneratedKeys);
|
||||
@@ -592,7 +592,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFlushOnMixed(boolean batchFlushOnMixed) {
|
||||
public final void setFlushOnMixed(boolean batchFlushOnMixed) {
|
||||
this.batchFlushOnMixed = batchFlushOnMixed;
|
||||
if (batchControl != null) {
|
||||
batchControl.setBatchFlushOnMixed(batchFlushOnMixed);
|
||||
@@ -606,12 +606,12 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
* </p>
|
||||
*/
|
||||
@Override
|
||||
public int getBatchSize() {
|
||||
public final int getBatchSize() {
|
||||
return batchSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBatchSize(int batchSize) {
|
||||
public final void setBatchSize(int batchSize) {
|
||||
this.batchSize = batchSize;
|
||||
if (batchControl != null) {
|
||||
batchControl.setBatchSize(batchSize);
|
||||
@@ -619,12 +619,12 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFlushOnQuery() {
|
||||
public final boolean isFlushOnQuery() {
|
||||
return batchFlushOnQuery;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFlushOnQuery(boolean batchFlushOnQuery) {
|
||||
public final void setFlushOnQuery(boolean batchFlushOnQuery) {
|
||||
this.batchFlushOnQuery = batchFlushOnQuery;
|
||||
}
|
||||
|
||||
@@ -633,12 +633,12 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
* this request should be executed immediately.
|
||||
*/
|
||||
@Override
|
||||
public boolean isBatchThisRequest() {
|
||||
public final boolean isBatchThisRequest() {
|
||||
return batchMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkBatchEscalationOnCollection() {
|
||||
public final void checkBatchEscalationOnCollection() {
|
||||
if (!batchMode && batchOnCascadeMode) {
|
||||
batchMode = true;
|
||||
batchOnCascadeSet = true;
|
||||
@@ -646,7 +646,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flushBatchOnCollection() {
|
||||
public final void flushBatchOnCollection() {
|
||||
if (batchOnCascadeSet) {
|
||||
batchFlushReset();
|
||||
// restore the previous batch mode of NONE
|
||||
@@ -675,7 +675,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PersistenceException translate(String message, SQLException cause) {
|
||||
public final PersistenceException translate(String message, SQLException cause) {
|
||||
if (manager != null) {
|
||||
return manager.translate(message, cause);
|
||||
}
|
||||
@@ -686,14 +686,14 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
* Flush after completing persist cascade.
|
||||
*/
|
||||
@Override
|
||||
public void flushBatchOnCascade() {
|
||||
public final void flushBatchOnCascade() {
|
||||
batchFlushReset();
|
||||
// restore the previous batch mode
|
||||
batchMode = oldBatchMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flushBatchOnRollback() {
|
||||
public final void flushBatchOnRollback() {
|
||||
internalBatchClear();
|
||||
// restore the previous batch mode
|
||||
batchMode = oldBatchMode;
|
||||
@@ -709,13 +709,11 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkBatchEscalationOnCascade(PersistRequestBean<?> request) {
|
||||
|
||||
public final boolean checkBatchEscalationOnCascade(PersistRequestBean<?> request) {
|
||||
if (batchMode) {
|
||||
// already batching (at top level)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (batchOnCascadeMode) {
|
||||
// escalate up to batch mode for this request (and cascade)
|
||||
oldBatchMode = false;
|
||||
@@ -725,13 +723,12 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
request.setSkipBatchForTopLevel();
|
||||
return true;
|
||||
}
|
||||
|
||||
batchFlushReset();
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BatchControl getBatchControl() {
|
||||
public final BatchControl getBatchControl() {
|
||||
return batchControl;
|
||||
}
|
||||
|
||||
@@ -740,7 +737,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
* on the first persist request.
|
||||
*/
|
||||
@Override
|
||||
public void setBatchControl(BatchControl batchControl) {
|
||||
public final void setBatchControl(BatchControl batchControl) {
|
||||
queryOnly = false;
|
||||
this.batchControl = batchControl;
|
||||
// in case these parameters have already been set
|
||||
@@ -763,7 +760,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
* </p>
|
||||
*/
|
||||
@Override
|
||||
public void flush() {
|
||||
public final void flush() {
|
||||
if (!isActive()) {
|
||||
throw new IllegalStateException(illegalStateMessage);
|
||||
}
|
||||
@@ -771,7 +768,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flushBatch() {
|
||||
public final void flushBatch() {
|
||||
flush();
|
||||
}
|
||||
|
||||
@@ -797,7 +794,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
* Return the persistence context associated with this transaction.
|
||||
*/
|
||||
@Override
|
||||
public SpiPersistenceContext getPersistenceContext() {
|
||||
public final SpiPersistenceContext getPersistenceContext() {
|
||||
return persistenceContext;
|
||||
}
|
||||
|
||||
@@ -809,7 +806,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
* then set it back later to a second transaction.
|
||||
*/
|
||||
@Override
|
||||
public void setPersistenceContext(SpiPersistenceContext context) {
|
||||
public final void setPersistenceContext(SpiPersistenceContext context) {
|
||||
if (!isActive()) {
|
||||
throw new IllegalStateException(illegalStateMessage);
|
||||
}
|
||||
@@ -820,7 +817,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
* Return the underlying TransactionEvent.
|
||||
*/
|
||||
@Override
|
||||
public TransactionEvent getEvent() {
|
||||
public final TransactionEvent getEvent() {
|
||||
queryOnly = false;
|
||||
if (event == null) {
|
||||
event = new TransactionEvent();
|
||||
@@ -832,27 +829,27 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
* Return true if this was an explicitly created transaction.
|
||||
*/
|
||||
@Override
|
||||
public boolean isExplicit() {
|
||||
public final boolean isExplicit() {
|
||||
return explicit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLogSql() {
|
||||
public final boolean isLogSql() {
|
||||
return logSql;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLogSummary() {
|
||||
public final boolean isLogSummary() {
|
||||
return logSummary;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logSql(String msg) {
|
||||
public final void logSql(String msg) {
|
||||
manager.log().sql().debug(Str.add(logPrefix, msg));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logSummary(String msg) {
|
||||
public final void logSummary(String msg) {
|
||||
manager.log().sum().debug(Str.add(logPrefix, msg));
|
||||
}
|
||||
|
||||
@@ -860,17 +857,17 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
* Return the transaction id.
|
||||
*/
|
||||
@Override
|
||||
public String getId() {
|
||||
public final String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTenantId(Object tenantId) {
|
||||
public final void setTenantId(Object tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getTenantId() {
|
||||
public final Object getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
@@ -926,7 +923,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
/**
|
||||
* Notify the transaction manager.
|
||||
*/
|
||||
void notifyCommit() {
|
||||
final void notifyCommit() {
|
||||
if (manager != null) {
|
||||
if (queryOnly) {
|
||||
manager.notifyOfQueryOnly(this);
|
||||
@@ -1000,13 +997,13 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postCommit() {
|
||||
public final void postCommit() {
|
||||
firePostCommit();
|
||||
notifyCommit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preCommit() {
|
||||
public final void preCommit() {
|
||||
internalBatchFlush();
|
||||
firePreCommit();
|
||||
}
|
||||
@@ -1081,7 +1078,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
/**
|
||||
* Notify the transaction manager.
|
||||
*/
|
||||
void notifyRollback(Throwable cause) {
|
||||
final void notifyRollback(Throwable cause) {
|
||||
if (manager != null) {
|
||||
if (queryOnly) {
|
||||
manager.notifyOfQueryOnly(this);
|
||||
@@ -1095,7 +1092,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
* Return true if the transaction is marked as rollback only.
|
||||
*/
|
||||
@Override
|
||||
public boolean isRollbackOnly() {
|
||||
public final boolean isRollbackOnly() {
|
||||
return rollbackOnly;
|
||||
}
|
||||
|
||||
@@ -1103,17 +1100,17 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
* Mark the transaction as rollback only.
|
||||
*/
|
||||
@Override
|
||||
public void setRollbackOnly() {
|
||||
public final void setRollbackOnly() {
|
||||
this.rollbackOnly = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNestedUseSavepoint() {
|
||||
public final boolean isNestedUseSavepoint() {
|
||||
return nestedUseSavepoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNestedUseSavepoint() {
|
||||
public final void setNestedUseSavepoint() {
|
||||
this.nestedUseSavepoint = true;
|
||||
}
|
||||
|
||||
@@ -1159,7 +1156,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postRollback(Throwable cause) {
|
||||
public final void postRollback(Throwable cause) {
|
||||
firePostRollback();
|
||||
notifyRollback(cause);
|
||||
}
|
||||
@@ -1183,22 +1180,22 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPersistCascade() {
|
||||
public final boolean isPersistCascade() {
|
||||
return persistCascade;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPersistCascade(boolean persistCascade) {
|
||||
public final void setPersistCascade(boolean persistCascade) {
|
||||
this.persistCascade = persistCascade;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addModification(String tableName, boolean inserts, boolean updates, boolean deletes) {
|
||||
public final void addModification(String tableName, boolean inserts, boolean updates, boolean deletes) {
|
||||
getEvent().add(tableName, inserts, updates, deletes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DocStoreTransaction getDocStoreTransaction() {
|
||||
public final DocStoreTransaction getDocStoreTransaction() {
|
||||
if (docStoreTxn == null) {
|
||||
queryOnly = false;
|
||||
docStoreTxn = manager.createDocStoreTransaction(docStoreBatchSize);
|
||||
@@ -1207,7 +1204,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putUserObject(String name, Object value) {
|
||||
public final void putUserObject(String name, Object value) {
|
||||
if (userObjects == null) {
|
||||
userObjects = new HashMap<>();
|
||||
}
|
||||
@@ -1215,7 +1212,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getUserObject(String name) {
|
||||
public final Object getUserObject(String name) {
|
||||
if (userObjects == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -1226,7 +1223,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
* Alias for end(), which enables this class to be used in try-with-resources.
|
||||
*/
|
||||
@Override
|
||||
public void close() {
|
||||
public final void close() {
|
||||
end();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.sql.SQLException;
|
||||
/**
|
||||
* Jta based transaction.
|
||||
*/
|
||||
public class JtaTransaction extends JdbcTransaction {
|
||||
public final class JtaTransaction extends JdbcTransaction {
|
||||
|
||||
private final UserTransaction userTransaction;
|
||||
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ import javax.transaction.UserTransaction;
|
||||
/**
|
||||
* Hook into external JTA transaction manager.
|
||||
*/
|
||||
public class JtaTransactionManager implements ExternalTransactionManager {
|
||||
public final class JtaTransactionManager implements ExternalTransactionManager {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(JtaTransactionManager.class);
|
||||
|
||||
|
||||
@@ -19,9 +19,9 @@ import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* Place holder for use with SUPPORTS and NEVER transactional when there really isn't a transaction.
|
||||
* Placeholder for use with SUPPORTS and NEVER transactional when there really isn't a transaction.
|
||||
*/
|
||||
class NoTransaction implements SpiTransaction {
|
||||
final class NoTransaction implements SpiTransaction {
|
||||
|
||||
static final NoTransaction INSTANCE = new NoTransaction();
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import io.ebeaninternal.api.SpiProfileHandler;
|
||||
/**
|
||||
* A do nothing SpiProfileHandler.
|
||||
*/
|
||||
public class NoopProfileHandler implements SpiProfileHandler {
|
||||
public final class NoopProfileHandler implements SpiProfileHandler {
|
||||
|
||||
@Override
|
||||
public void collectTransactionProfile(TransactionProfile transactionProfile) {
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.io.IOException;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class RemoteTableMod implements BinaryWritable {
|
||||
public final class RemoteTableMod implements BinaryWritable {
|
||||
|
||||
private final long timestamp;
|
||||
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RemoteTransactionEvent implements Runnable, BinaryWritable {
|
||||
public final class RemoteTransactionEvent implements Runnable, BinaryWritable {
|
||||
|
||||
private final List<BeanPersistIds> beanPersistList = new ArrayList<>();
|
||||
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ import java.sql.Savepoint;
|
||||
/**
|
||||
* A nested transaction that represents a Savepoint.
|
||||
*/
|
||||
class SavepointTransaction extends SpiTransactionProxy {
|
||||
final class SavepointTransaction extends SpiTransactionProxy {
|
||||
|
||||
private static final int STATE_COMMITTED = 1;
|
||||
private static final int STATE_ROLLED_BACK = 2;
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.UUID;
|
||||
* Holder of the changes handling the case when we send the changes
|
||||
* prior to commit or rollback as we hit the allowed 'batch size'.
|
||||
*/
|
||||
public class TChangeLogHolder {
|
||||
public final class TChangeLogHolder {
|
||||
|
||||
/**
|
||||
* The owning transaction.
|
||||
|
||||
@@ -17,7 +17,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
* This information is used to validate entries in the L2 query caches.
|
||||
* </p>
|
||||
*/
|
||||
public class TableModState implements QueryCacheEntryValidate, ServerCacheNotify {
|
||||
public final class TableModState implements QueryCacheEntryValidate, ServerCacheNotify {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger("io.ebean.cache.TABLEMOD");
|
||||
|
||||
|
||||
+1
-4
@@ -33,8 +33,7 @@ abstract class TransactionFactory {
|
||||
/**
|
||||
* Set the Transaction Isolation level if required.
|
||||
*/
|
||||
SpiTransaction setIsolationLevel(SpiTransaction t, boolean explicit, int isolationLevel) {
|
||||
|
||||
final SpiTransaction setIsolationLevel(SpiTransaction t, boolean explicit, int isolationLevel) {
|
||||
if (isolationLevel > -1) {
|
||||
Connection connection = t.getConnection();
|
||||
try {
|
||||
@@ -44,11 +43,9 @@ abstract class TransactionFactory {
|
||||
throw new PersistenceException(e);
|
||||
}
|
||||
}
|
||||
|
||||
if (explicit && manager.log().txn().isTrace()) {
|
||||
manager.log().txn().trace(t.getLogPrefix() + "Begin");
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -22,7 +22,6 @@ class TransactionFactoryBasic extends TransactionFactory {
|
||||
|
||||
@Override
|
||||
public SpiTransaction createReadOnlyTransaction(Object tenantId) {
|
||||
|
||||
Connection connection = null;
|
||||
try {
|
||||
connection = dataSource.getConnection();
|
||||
@@ -37,7 +36,7 @@ class TransactionFactoryBasic extends TransactionFactory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpiTransaction createTransaction(boolean explicit, int isolationLevel) {
|
||||
public final SpiTransaction createTransaction(boolean explicit, int isolationLevel) {
|
||||
Connection connection = null;
|
||||
try {
|
||||
connection = dataSource.getConnection();
|
||||
|
||||
+1
-4
@@ -16,7 +16,7 @@ import java.sql.SQLException;
|
||||
* - Skip explicit commit (as we use AutoCommit instead)
|
||||
* </p>
|
||||
*/
|
||||
class TransactionFactoryBasicWithRead extends TransactionFactoryBasic {
|
||||
final class TransactionFactoryBasicWithRead extends TransactionFactoryBasic {
|
||||
|
||||
private final DataSource readOnlyDataSource;
|
||||
|
||||
@@ -27,16 +27,13 @@ class TransactionFactoryBasicWithRead extends TransactionFactoryBasic {
|
||||
|
||||
@Override
|
||||
public SpiTransaction createReadOnlyTransaction(Object tenantId) {
|
||||
|
||||
Connection connection = null;
|
||||
try {
|
||||
connection = readOnlyDataSource.getConnection();
|
||||
return new ImplicitReadOnlyTransaction(manager, connection);
|
||||
|
||||
} catch (PersistenceException ex) {
|
||||
JdbcClose.close(connection);
|
||||
throw ex;
|
||||
|
||||
} catch (SQLException ex) {
|
||||
throw new PersistenceException(ex);
|
||||
}
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import io.ebean.config.CurrentTenantProvider;
|
||||
/**
|
||||
* Helper to build and return the appropriate TransactionFactory.
|
||||
*/
|
||||
class TransactionFactoryBuilder {
|
||||
final class TransactionFactoryBuilder {
|
||||
|
||||
/**
|
||||
* Build and return based on multi-tenancy and read only DataSource.
|
||||
|
||||
+1
-2
@@ -29,8 +29,7 @@ class TransactionFactoryTenant extends TransactionFactory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpiTransaction createTransaction(boolean explicit, int isolationLevel) {
|
||||
|
||||
public final SpiTransaction createTransaction(boolean explicit, int isolationLevel) {
|
||||
SpiTransaction t = create(explicit, null);
|
||||
return setIsolationLevel(t, explicit, isolationLevel);
|
||||
}
|
||||
|
||||
+1
-4
@@ -16,7 +16,7 @@ import java.sql.SQLException;
|
||||
* - Skip explicit commit (as we use AutoCommit instead)
|
||||
* </p>
|
||||
*/
|
||||
class TransactionFactoryTenantWithRead extends TransactionFactoryTenant {
|
||||
final class TransactionFactoryTenantWithRead extends TransactionFactoryTenant {
|
||||
|
||||
TransactionFactoryTenantWithRead(TransactionManager manager, DataSourceSupplier dataSourceSupplier, CurrentTenantProvider tenantProvider) {
|
||||
super(manager, dataSourceSupplier, tenantProvider);
|
||||
@@ -24,7 +24,6 @@ class TransactionFactoryTenantWithRead extends TransactionFactoryTenant {
|
||||
|
||||
@Override
|
||||
public SpiTransaction createReadOnlyTransaction(Object tenantId) {
|
||||
|
||||
Connection connection = null;
|
||||
try {
|
||||
if (tenantId == null) {
|
||||
@@ -33,11 +32,9 @@ class TransactionFactoryTenantWithRead extends TransactionFactoryTenant {
|
||||
}
|
||||
connection = dataSourceSupplier.getReadOnlyConnection(tenantId);
|
||||
return new ImplicitReadOnlyTransaction(manager, connection, tenantId);
|
||||
|
||||
} catch (PersistenceException ex) {
|
||||
JdbcClose.close(connection);
|
||||
throw ex;
|
||||
|
||||
} catch (SQLException ex) {
|
||||
throw new PersistenceException(ex);
|
||||
}
|
||||
|
||||
+45
-45
@@ -201,14 +201,14 @@ public class TransactionManager implements SpiTransactionManager {
|
||||
/**
|
||||
* Return the scope manager.
|
||||
*/
|
||||
public TransactionScopeManager scope() {
|
||||
public final TransactionScopeManager scope() {
|
||||
return scopeManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the transaction onto the scope.
|
||||
*/
|
||||
public void set(SpiTransaction txn) {
|
||||
public final void set(SpiTransaction txn) {
|
||||
scopeManager.set(txn);
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ public class TransactionManager implements SpiTransactionManager {
|
||||
* Return the current active transaction.
|
||||
*/
|
||||
@Override
|
||||
public SpiTransaction getActive() {
|
||||
public final SpiTransaction getActive() {
|
||||
return scopeManager.getActive();
|
||||
}
|
||||
|
||||
@@ -230,18 +230,18 @@ public class TransactionManager implements SpiTransactionManager {
|
||||
/**
|
||||
* Return the current transaction from thread local scope. Note that it may be inactive.
|
||||
*/
|
||||
public SpiTransaction getInScope() {
|
||||
public final SpiTransaction getInScope() {
|
||||
return scopeManager.getInScope();
|
||||
}
|
||||
|
||||
/**
|
||||
* Translate the SQLException into a specific exception if possible based on the DB platform.
|
||||
*/
|
||||
public PersistenceException translate(String message, SQLException cause) {
|
||||
public final PersistenceException translate(String message, SQLException cause) {
|
||||
return databasePlatform.translate(message, cause);
|
||||
}
|
||||
|
||||
public void shutdown(boolean shutdownDataSource, boolean deregisterDriver) {
|
||||
public final void shutdown(boolean shutdownDataSource, boolean deregisterDriver) {
|
||||
if (shutdownDataSource) {
|
||||
dataSourceSupplier.shutdown(deregisterDriver);
|
||||
}
|
||||
@@ -250,39 +250,39 @@ public class TransactionManager implements SpiTransactionManager {
|
||||
/**
|
||||
* Return true if the DB platform supports SavepointId().
|
||||
*/
|
||||
boolean isSupportsSavepointId() {
|
||||
final boolean isSupportsSavepointId() {
|
||||
return supportsSavepointId;
|
||||
}
|
||||
|
||||
boolean isDocStoreActive() {
|
||||
final boolean isDocStoreActive() {
|
||||
return docStoreActive;
|
||||
}
|
||||
|
||||
DocStoreTransaction createDocStoreTransaction(int docStoreBatchSize) {
|
||||
final DocStoreTransaction createDocStoreTransaction(int docStoreBatchSize) {
|
||||
return docStoreUpdateProcessor.createTransaction(docStoreBatchSize);
|
||||
}
|
||||
|
||||
boolean isSkipCacheAfterWrite() {
|
||||
final boolean isSkipCacheAfterWrite() {
|
||||
return skipCacheAfterWrite;
|
||||
}
|
||||
|
||||
public BeanDescriptorManager getBeanDescriptorManager() {
|
||||
public final BeanDescriptorManager getBeanDescriptorManager() {
|
||||
return beanDescriptorManager;
|
||||
}
|
||||
|
||||
BulkEventListenerMap getBulkEventListenerMap() {
|
||||
final BulkEventListenerMap getBulkEventListenerMap() {
|
||||
return bulkEventListenerMap;
|
||||
}
|
||||
|
||||
boolean isAutoPersistUpdates() {
|
||||
final boolean isAutoPersistUpdates() {
|
||||
return autoPersistUpdates;
|
||||
}
|
||||
|
||||
boolean isPersistBatch() {
|
||||
final boolean isPersistBatch() {
|
||||
return persistBatch;
|
||||
}
|
||||
|
||||
boolean isPersistBatchOnCascade() {
|
||||
final boolean isPersistBatchOnCascade() {
|
||||
return persistBatchOnCascade;
|
||||
}
|
||||
|
||||
@@ -296,7 +296,7 @@ public class TransactionManager implements SpiTransactionManager {
|
||||
* If the Isolation level is higher (say SERIALIZABLE) then Connections used
|
||||
* just for queries do need to be committed or rollback after the query.
|
||||
*/
|
||||
OnQueryOnly initOnQueryOnly(OnQueryOnly dbPlatformOnQueryOnly) {
|
||||
final OnQueryOnly initOnQueryOnly(OnQueryOnly dbPlatformOnQueryOnly) {
|
||||
// first check for a system property 'override'
|
||||
String systemPropertyValue = System.getProperty("ebean.transaction.onqueryonly");
|
||||
if (systemPropertyValue != null) {
|
||||
@@ -306,29 +306,29 @@ public class TransactionManager implements SpiTransactionManager {
|
||||
return dbPlatformOnQueryOnly == null ? OnQueryOnly.COMMIT : dbPlatformOnQueryOnly;
|
||||
}
|
||||
|
||||
public String getServerName() {
|
||||
public final String getServerName() {
|
||||
return serverName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Connection getQueryPlanConnection() throws SQLException {
|
||||
public final Connection getQueryPlanConnection() throws SQLException {
|
||||
return dataSourceSupplier.getConnection(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSource getDataSource() {
|
||||
public final DataSource getDataSource() {
|
||||
return dataSourceSupplier.getDataSource();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSource getReadOnlyDataSource() {
|
||||
public final DataSource getReadOnlyDataSource() {
|
||||
return dataSourceSupplier.getReadOnlyDataSource();
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the type of behavior to use when closing a transaction that was used to query data only.
|
||||
*/
|
||||
OnQueryOnly getOnQueryOnly() {
|
||||
final OnQueryOnly getOnQueryOnly() {
|
||||
return onQueryOnly;
|
||||
}
|
||||
|
||||
@@ -390,7 +390,7 @@ public class TransactionManager implements SpiTransactionManager {
|
||||
* Process a local rolled back transaction.
|
||||
*/
|
||||
@Override
|
||||
public void notifyOfRollback(SpiTransaction transaction, Throwable cause) {
|
||||
public final void notifyOfRollback(SpiTransaction transaction, Throwable cause) {
|
||||
try {
|
||||
if (txnLogger.isDebug()) {
|
||||
String msg = transaction.getLogPrefix() + "Rollback";
|
||||
@@ -408,7 +408,7 @@ public class TransactionManager implements SpiTransactionManager {
|
||||
* Query only transaction in read committed isolation.
|
||||
*/
|
||||
@Override
|
||||
public void notifyOfQueryOnly(SpiTransaction transaction) {
|
||||
public final void notifyOfQueryOnly(SpiTransaction transaction) {
|
||||
// Nothing that interesting here
|
||||
if (txnLogger.isTrace()) {
|
||||
txnLogger.trace(transaction.getLogPrefix() + "Commit - query only");
|
||||
@@ -442,7 +442,7 @@ public class TransactionManager implements SpiTransactionManager {
|
||||
* Process a local committed transaction.
|
||||
*/
|
||||
@Override
|
||||
public void notifyOfCommit(SpiTransaction transaction) {
|
||||
public final void notifyOfCommit(SpiTransaction transaction) {
|
||||
try {
|
||||
if (txnLogger.isDebug()) {
|
||||
txnLogger.debug(transaction.getLogPrefix() + "Commit");
|
||||
@@ -455,7 +455,7 @@ public class TransactionManager implements SpiTransactionManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void externalModification(TransactionEventTable tableEvent) {
|
||||
public final void externalModification(TransactionEventTable tableEvent) {
|
||||
SpiTransaction t = getActive();
|
||||
if (t != null) {
|
||||
t.getEvent().add(tableEvent);
|
||||
@@ -476,7 +476,7 @@ public class TransactionManager implements SpiTransactionManager {
|
||||
/**
|
||||
* Notify local BeanPersistListeners etc of events from another server in the cluster.
|
||||
*/
|
||||
public void remoteTransactionEvent(RemoteTransactionEvent remoteEvent) {
|
||||
public final void remoteTransactionEvent(RemoteTransactionEvent remoteEvent) {
|
||||
if (clusterLogger.isDebugEnabled()) {
|
||||
clusterLogger.debug("processing {}", remoteEvent);
|
||||
}
|
||||
@@ -506,14 +506,14 @@ public class TransactionManager implements SpiTransactionManager {
|
||||
/**
|
||||
* Process the docstore / ElasticSearch updates.
|
||||
*/
|
||||
void processDocStoreUpdates(DocStoreUpdates docStoreUpdates, int bulkBatchSize) {
|
||||
final void processDocStoreUpdates(DocStoreUpdates docStoreUpdates, int bulkBatchSize) {
|
||||
docStoreUpdateProcessor.process(docStoreUpdates, bulkBatchSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare and then send/log the changeSet.
|
||||
*/
|
||||
void sendChangeLog(final ChangeSet changeSet) {
|
||||
final void sendChangeLog(final ChangeSet changeSet) {
|
||||
// can set userId, userIpAddress & userContext if desired
|
||||
if (changeLogPrepare.prepare(changeSet)) {
|
||||
if (changeLogAsync) {
|
||||
@@ -528,7 +528,7 @@ public class TransactionManager implements SpiTransactionManager {
|
||||
/**
|
||||
* Invalidate the query caches for entities based on views.
|
||||
*/
|
||||
void processTouchedTables(Set<String> touchedTables) {
|
||||
final void processTouchedTables(Set<String> touchedTables) {
|
||||
tableModState.touch(touchedTables);
|
||||
if (viewInvalidation) {
|
||||
beanDescriptorManager.processViewInvalidation(touchedTables);
|
||||
@@ -539,32 +539,32 @@ public class TransactionManager implements SpiTransactionManager {
|
||||
/**
|
||||
* Process the collected transaction profiling information.
|
||||
*/
|
||||
void profileCollect(TransactionProfile transactionProfile) {
|
||||
final void profileCollect(TransactionProfile transactionProfile) {
|
||||
profileHandler.collectTransactionProfile(transactionProfile);
|
||||
}
|
||||
|
||||
/**
|
||||
* Collect execution time for an explicit transaction.
|
||||
*/
|
||||
void collectMetric(long exeMicros) {
|
||||
final void collectMetric(long exeMicros) {
|
||||
txnMain.add(exeMicros);
|
||||
}
|
||||
|
||||
/**
|
||||
* Collect execution time for implicit read only transaction.
|
||||
*/
|
||||
void collectMetricReadOnly(long exeMicros) {
|
||||
final void collectMetricReadOnly(long exeMicros) {
|
||||
txnReadOnly.add(exeMicros);
|
||||
}
|
||||
|
||||
/**
|
||||
* Collect execution time for a named transaction.
|
||||
*/
|
||||
void collectMetricNamed(long exeMicros, String label) {
|
||||
final void collectMetricNamed(long exeMicros, String label) {
|
||||
txnNamed.add(label, exeMicros);
|
||||
}
|
||||
|
||||
public void visitMetrics(MetricVisitor visitor) {
|
||||
public final void visitMetrics(MetricVisitor visitor) {
|
||||
txnMain.visit(visitor);
|
||||
txnReadOnly.visit(visitor);
|
||||
txnNamed.visit(visitor);
|
||||
@@ -576,14 +576,14 @@ public class TransactionManager implements SpiTransactionManager {
|
||||
/**
|
||||
* Clear an implicit transaction from thread local scope.
|
||||
*/
|
||||
public void clearServerTransaction() {
|
||||
public final void clearServerTransaction() {
|
||||
scopeManager.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Begin an implicit transaction.
|
||||
*/
|
||||
public SpiTransaction beginServerTransaction() {
|
||||
public final SpiTransaction beginServerTransaction() {
|
||||
SpiTransaction t = createTransaction(false, -1);
|
||||
scopeManager.set(t);
|
||||
return t;
|
||||
@@ -592,7 +592,7 @@ public class TransactionManager implements SpiTransactionManager {
|
||||
/**
|
||||
* Exit a scoped transaction (that can be inactive - already committed etc).
|
||||
*/
|
||||
public void exitScopedTransaction(Object returnOrThrowable, int opCode) {
|
||||
public final void exitScopedTransaction(Object returnOrThrowable, int opCode) {
|
||||
SpiTransaction st = getInScope();
|
||||
if (st instanceof ScopedTransaction) {
|
||||
// can be null for Supports as that can start as a 'No Transaction' and then
|
||||
@@ -602,7 +602,7 @@ public class TransactionManager implements SpiTransactionManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void externalRemoveTransaction() {
|
||||
public final void externalRemoveTransaction() {
|
||||
scopeManager.clearExternal();
|
||||
}
|
||||
|
||||
@@ -611,7 +611,7 @@ public class TransactionManager implements SpiTransactionManager {
|
||||
* (e.g. Spring managed transaction).
|
||||
*/
|
||||
@Override
|
||||
public ScopedTransaction externalBeginTransaction(SpiTransaction transaction, TxScope txScope) {
|
||||
public final ScopedTransaction externalBeginTransaction(SpiTransaction transaction, TxScope txScope) {
|
||||
ScopedTransaction scopedTxn = new ScopedTransaction(scopeManager);
|
||||
scopedTxn.push(new ScopeTrans(rollbackOnChecked, false, transaction, txScope));
|
||||
scopeManager.replace(scopedTxn);
|
||||
@@ -621,7 +621,7 @@ public class TransactionManager implements SpiTransactionManager {
|
||||
/**
|
||||
* Begin a scoped transaction.
|
||||
*/
|
||||
public ScopedTransaction beginScopedTransaction(TxScope txScope) {
|
||||
public final ScopedTransaction beginScopedTransaction(TxScope txScope) {
|
||||
txScope = initTxScope(txScope);
|
||||
ScopedTransaction txnContainer = getActiveScoped();
|
||||
|
||||
@@ -742,26 +742,26 @@ public class TransactionManager implements SpiTransactionManager {
|
||||
/**
|
||||
* Return true if Transaction debug is on.
|
||||
*/
|
||||
public boolean isTxnDebug() {
|
||||
public final boolean isTxnDebug() {
|
||||
return txnDebug;
|
||||
}
|
||||
|
||||
public SpiLogManager log() {
|
||||
public final SpiLogManager log() {
|
||||
return logManager;
|
||||
}
|
||||
|
||||
public boolean isLogSql() {
|
||||
public final boolean isLogSql() {
|
||||
return logManager.sql().isDebug();
|
||||
}
|
||||
|
||||
public boolean isLogSummary() {
|
||||
public final boolean isLogSummary() {
|
||||
return logManager.sum().isDebug();
|
||||
}
|
||||
|
||||
/**
|
||||
* Experimental - find dirty beans in the persistence context and persist them.
|
||||
*/
|
||||
public void flushTransparent(SpiPersistenceContext persistenceContext, SpiTransaction transaction) {
|
||||
public final void flushTransparent(SpiPersistenceContext persistenceContext, SpiTransaction transaction) {
|
||||
List<Object> dirtyBeans = persistenceContext.dirtyBeans(beanDescriptorManager);
|
||||
if (!dirtyBeans.isEmpty()) {
|
||||
server.updateAll(dirtyBeans, transaction);
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ import io.ebeanservice.docstore.api.DocStoreUpdateProcessor;
|
||||
/**
|
||||
* Objects supplied for constructing the TransactionManager.
|
||||
*/
|
||||
public class TransactionManagerOptions {
|
||||
public final class TransactionManagerOptions {
|
||||
|
||||
final SpiServer server;
|
||||
final boolean notifyL2CacheInForeground;
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import io.ebean.ProfileLocation;
|
||||
/**
|
||||
* Profiling information for a single transaction that has completed.
|
||||
*/
|
||||
public class TransactionProfile {
|
||||
public final class TransactionProfile {
|
||||
|
||||
private final ProfileLocation location;
|
||||
private final String label;
|
||||
|
||||
Reference in New Issue
Block a user