TransactionSynchronization declared with default methods

Issue: SPR-14432
This commit is contained in:
Juergen Hoeller
2017-03-14 15:18:53 +01:00
parent e4741b8e42
commit 4e82bf30c6

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2014 the original author or authors. * Copyright 2002-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -52,14 +52,16 @@ public interface TransactionSynchronization extends Flushable {
* Supposed to unbind resources from TransactionSynchronizationManager if managing any. * Supposed to unbind resources from TransactionSynchronizationManager if managing any.
* @see TransactionSynchronizationManager#unbindResource * @see TransactionSynchronizationManager#unbindResource
*/ */
void suspend(); default void suspend() {
}
/** /**
* Resume this synchronization. * Resume this synchronization.
* Supposed to rebind resources to TransactionSynchronizationManager if managing any. * Supposed to rebind resources to TransactionSynchronizationManager if managing any.
* @see TransactionSynchronizationManager#bindResource * @see TransactionSynchronizationManager#bindResource
*/ */
void resume(); default void resume() {
}
/** /**
* Flush the underlying session to the datastore, if applicable: * Flush the underlying session to the datastore, if applicable:
@@ -67,7 +69,8 @@ public interface TransactionSynchronization extends Flushable {
* @see org.springframework.transaction.TransactionStatus#flush() * @see org.springframework.transaction.TransactionStatus#flush()
*/ */
@Override @Override
void flush(); default void flush() {
}
/** /**
* Invoked before transaction commit (before "beforeCompletion"). * Invoked before transaction commit (before "beforeCompletion").
@@ -83,7 +86,8 @@ public interface TransactionSynchronization extends Flushable {
* (note: do not throw TransactionException subclasses here!) * (note: do not throw TransactionException subclasses here!)
* @see #beforeCompletion * @see #beforeCompletion
*/ */
void beforeCommit(boolean readOnly); default void beforeCommit(boolean readOnly) {
}
/** /**
* Invoked before transaction commit/rollback. * Invoked before transaction commit/rollback.
@@ -96,7 +100,8 @@ public interface TransactionSynchronization extends Flushable {
* @see #beforeCommit * @see #beforeCommit
* @see #afterCompletion * @see #afterCompletion
*/ */
void beforeCompletion(); default void beforeCompletion() {
}
/** /**
* Invoked after transaction commit. Can perform further operations right * Invoked after transaction commit. Can perform further operations right
@@ -113,7 +118,8 @@ public interface TransactionSynchronization extends Flushable {
* @throws RuntimeException in case of errors; will be <b>propagated to the caller</b> * @throws RuntimeException in case of errors; will be <b>propagated to the caller</b>
* (note: do not throw TransactionException subclasses here!) * (note: do not throw TransactionException subclasses here!)
*/ */
void afterCommit(); default void afterCommit() {
}
/** /**
* Invoked after transaction commit/rollback. * Invoked after transaction commit/rollback.
@@ -133,6 +139,7 @@ public interface TransactionSynchronization extends Flushable {
* @see #STATUS_UNKNOWN * @see #STATUS_UNKNOWN
* @see #beforeCompletion * @see #beforeCompletion
*/ */
void afterCompletion(int status); default void afterCompletion(int status) {
}
} }