Fixed Javadoc for `BulkOperationCleanupAction.affectedEntity`

- plus minor cleanups
This commit is contained in:
Steve Ebersole 2020-11-03 15:12:38 -06:00
parent 67fd24ecff
commit f45a88cb07
1 changed files with 25 additions and 25 deletions

View File

@ -91,7 +91,7 @@ public class BulkOperationCleanupAction implements Executable, Serializable {
}
}
this.affectedTableSpaces = spacesList.toArray( new String[ spacesList.size() ] );
this.affectedTableSpaces = spacesList.toArray( new String[ 0 ] );
}
/**
@ -106,7 +106,7 @@ public class BulkOperationCleanupAction implements Executable, Serializable {
* @param session The session to which this request is tied.
* @param tableSpaces The table spaces.
*/
@SuppressWarnings({ "unchecked" })
@SuppressWarnings( { "unchecked", "rawtypes" } )
public BulkOperationCleanupAction(SharedSessionContractImplementor session, Set tableSpaces) {
final LinkedHashSet<String> spacesList = new LinkedHashSet<>( tableSpaces );
@ -138,23 +138,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
* persister match against the defined affected table spaces.
* Check whether we should consider an entity as affected by the query. This
* defines inclusion of the entity in the clean-up.
*
* @param affectedTableSpaces The table spaces reported to be affected by
* the query.
* @param checkTableSpaces The table spaces (from the entity persister)
* to check against the affected table spaces.
*
* @return True if there are affected table spaces and any of the incoming
* check table spaces occur in that set.
* @return Whether the entity should be considered affected
*
* @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() ) {
return true;
}
@ -179,24 +182,21 @@ public class BulkOperationCleanupAction implements Executable, Serializable {
@Override
public AfterTransactionCompletionProcess getAfterTransactionCompletionProcess() {
return new AfterTransactionCompletionProcess() {
@Override
public void doAfterTransactionCompletion(boolean success, SharedSessionContractImplementor session) {
for ( EntityCleanup cleanup : entityCleanups ) {
cleanup.release();
}
entityCleanups.clear();
for ( NaturalIdCleanup cleanup : naturalIdCleanups ) {
cleanup.release();
}
naturalIdCleanups.clear();
for ( CollectionCleanup cleanup : collectionCleanups ) {
cleanup.release();
}
collectionCleanups.clear();
return (success, session) -> {
for ( EntityCleanup cleanup : entityCleanups ) {
cleanup.release();
}
entityCleanups.clear();
for ( NaturalIdCleanup cleanup : naturalIdCleanups ) {
cleanup.release();
}
naturalIdCleanups.clear();
for ( CollectionCleanup cleanup : collectionCleanups ) {
cleanup.release();
}
collectionCleanups.clear();
};
}