Skip to content

Commit

Permalink
HHH-15336 Deprecate SharedSessionContractImplementor#getTransactionSt…
Browse files Browse the repository at this point in the history
…artTimestamp() and CacheTransactionSynchronization#getCurrentTransactionStartTimestamp()
  • Loading branch information
dreab8 authored and Sanne committed Sep 21, 2022
1 parent a4b47d3 commit d4b2af9
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,9 @@ public class NoCachingTransactionSynchronizationImpl extends AbstractCacheTransa
public NoCachingTransactionSynchronizationImpl(RegionFactory regionFactory) {
super( regionFactory );
}

@Override
public long getCachingTimestamp() {
throw new UnsupportedOperationException( "Method not supported when 2LC is not enabled" );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,29 @@ public interface CacheTransactionSynchronization {
*
* @implSpec This "timestamp" need not be related to timestamp in the Java
* Date/millisecond sense. It just needs to be an incrementing value.
*
* @deprecated Use {@link CacheTransactionSynchronization#getCachingTimestamp()} instead.
*/
@Deprecated
long getCurrentTransactionStartTimestamp();

/**
* What is the start time of this context object?
*
* @apiNote If not currently joined to a transaction, the timestamp from
* the last transaction is safe to use. If not ever/yet joined to a
* transaction, a timestamp at the time the Session/CacheTransactionSynchronization
* were created should be returned.
*
* @implSpec This "timestamp" need not be related to timestamp in the Java
* Date/millisecond sense. It just needs to be an incrementing value.
*
* An UnsupportedOperationException is thrown if the Second Level Cache has not been enabled
*/
default long getCachingTimestamp(){
return getCurrentTransactionStartTimestamp();
}

/**
* Callback that owning Session has become joined to a resource transaction.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,10 @@ default void checkOpen() {
* @apiNote This "timestamp" need not be related to timestamp in the Java Date/millisecond
* sense. It just needs to be an incrementing value. See
* {@link CacheTransactionSynchronization#getCurrentTransactionStartTimestamp()}
*
* @deprecated no longer supported, when the Second Level Cache is enabled {{@link CacheTransactionSynchronization#getCachingTimestamp()}} can be used.
*/
@Deprecated
long getTransactionStartTimestamp();

/**
Expand Down

0 comments on commit d4b2af9

Please sign in to comment.