HHH-11209 : Log a DEBUG message if collection with queued operations is detached due to rollback; otherwise, log INFO message

This commit is contained in:
Gail Badner 2018-11-14 00:25:24 -08:00
parent d7d6e2882f
commit e12a688524
2 changed files with 22 additions and 12 deletions

View File

@ -627,18 +627,28 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
if ( !isTempSession ) {
if ( hasQueuedOperations() ) {
final String collectionInfoString = MessageHelper.collectionInfoString( getRole(), getKey() );
final TransactionStatus transactionStatus =
session.getTransactionCoordinator().getTransactionDriverControl().getStatus();
if ( transactionStatus.isOneOf(
TransactionStatus.ROLLED_BACK,
TransactionStatus.MARKED_ROLLBACK,
TransactionStatus.FAILED_COMMIT,
TransactionStatus.FAILED_ROLLBACK,
TransactionStatus.ROLLING_BACK
) ) {
LOG.queuedOperationWhenDetachFromSessionOnRollback( collectionInfoString );
try {
final TransactionStatus transactionStatus =
session.getTransactionCoordinator().getTransactionDriverControl().getStatus();
if ( transactionStatus.isOneOf(
TransactionStatus.ROLLED_BACK,
TransactionStatus.MARKED_ROLLBACK,
TransactionStatus.FAILED_COMMIT,
TransactionStatus.FAILED_ROLLBACK,
TransactionStatus.ROLLING_BACK
) ) {
// It was due to a rollback.
LOG.queuedOperationWhenDetachFromSessionOnRollback( collectionInfoString );
}
else {
// We don't know why the collection is being detached.
// Just log the info.
LOG.queuedOperationWhenDetachFromSession( collectionInfoString );
}
}
else {
catch (Exception e) {
// We don't know why the collection is being detached.
// Just log the info.
LOG.queuedOperationWhenDetachFromSession( collectionInfoString );
}
}

View File

@ -1837,7 +1837,7 @@ public interface CoreMessageLogger extends BasicLogger {
@Message(value = "Attaching an uninitialized collection with queued operations to a session: %s", id = 495)
void queuedOperationWhenAttachToSession(String collectionInfoString);
@LogMessage(level = WARN)
@LogMessage(level = INFO)
@Message(value = "Detaching an uninitialized collection with queued operations from a session: %s", id = 496)
void queuedOperationWhenDetachFromSession(String collectionInfoString);