Fixed Javadoc for `BulkOperationCleanupAction.affectedEntity`

This commit is contained in:
Steve Ebersole 2020-11-03 15:12:38 -06:00 committed by Sanne Grinovero
parent c4eacbbd04
commit 204dc9f9db
1 changed files with 25 additions and 26 deletions

View File

@ -90,7 +90,7 @@ public class BulkOperationCleanupAction implements Executable, Serializable {
} }
} }
this.affectedTableSpaces = spacesList.toArray( new String[ spacesList.size() ] ); this.affectedTableSpaces = spacesList.toArray( new String[ 0 ] );
} }
/** /**
@ -105,7 +105,7 @@ public class BulkOperationCleanupAction implements Executable, Serializable {
* @param session The session to which this request is tied. * @param session The session to which this request is tied.
* @param tableSpaces The table spaces. * @param tableSpaces The table spaces.
*/ */
@SuppressWarnings({ "unchecked" }) @SuppressWarnings( { "unchecked", "rawtypes" } )
public BulkOperationCleanupAction(SharedSessionContractImplementor session, Set tableSpaces) { public BulkOperationCleanupAction(SharedSessionContractImplementor session, Set tableSpaces) {
final LinkedHashSet<String> spacesList = new LinkedHashSet<>(); final LinkedHashSet<String> spacesList = new LinkedHashSet<>();
spacesList.addAll( tableSpaces ); spacesList.addAll( tableSpaces );
@ -137,23 +137,26 @@ public class BulkOperationCleanupAction implements Executable, Serializable {
} }
} }
this.affectedTableSpaces = spacesList.toArray( new String[ spacesList.size() ] ); this.affectedTableSpaces = spacesList.toArray( new String[ 0 ] );
} }
/** /**
* Check to determine whether the table spaces reported by an entity * Check whether we should consider an entity as affected by the query. This
* persister match against the defined affected table spaces. * defines inclusion of the entity in the clean-up.
* *
* @param affectedTableSpaces The table spaces reported to be affected by * @param affectedTableSpaces The table spaces reported to be affected by
* the query. * the query.
* @param checkTableSpaces The table spaces (from the entity persister) * @param checkTableSpaces The table spaces (from the entity persister)
* to check against the affected table spaces. * to check against the affected table spaces.
* *
* @return True if there are affected table spaces and any of the incoming * @return Whether the entity should be considered affected
* check table spaces occur in that set. *
* @implNote An entity is considered to be affected if either (1) the affected table
* spaces are not known or (2) any of the incoming check table spaces occur
* in that set.
*/ */
private boolean affectedEntity(Set affectedTableSpaces, Serializable[] checkTableSpaces) { private boolean affectedEntity(Set<?> affectedTableSpaces, Serializable[] checkTableSpaces) {
if ( affectedTableSpaces == null || affectedTableSpaces.isEmpty() ) { if ( affectedTableSpaces == null || affectedTableSpaces.isEmpty() ) {
return true; return true;
} }
@ -178,9 +181,7 @@ public class BulkOperationCleanupAction implements Executable, Serializable {
@Override @Override
public AfterTransactionCompletionProcess getAfterTransactionCompletionProcess() { public AfterTransactionCompletionProcess getAfterTransactionCompletionProcess() {
return new AfterTransactionCompletionProcess() { return (success, session) -> {
@Override
public void doAfterTransactionCompletion(boolean success, SharedSessionContractImplementor session) {
for ( EntityCleanup cleanup : entityCleanups ) { for ( EntityCleanup cleanup : entityCleanups ) {
cleanup.release(); cleanup.release();
} }
@ -188,15 +189,13 @@ public class BulkOperationCleanupAction implements Executable, Serializable {
for ( NaturalIdCleanup cleanup : naturalIdCleanups ) { for ( NaturalIdCleanup cleanup : naturalIdCleanups ) {
cleanup.release(); cleanup.release();
} }
entityCleanups.clear(); naturalIdCleanups.clear();
for ( CollectionCleanup cleanup : collectionCleanups ) { for ( CollectionCleanup cleanup : collectionCleanups ) {
cleanup.release(); cleanup.release();
} }
collectionCleanups.clear(); collectionCleanups.clear();
}
}; };
} }