Skip to content

Commit f45a88c

Browse files
committed
Fixed Javadoc for BulkOperationCleanupAction.affectedEntity
- plus minor cleanups
1 parent 67fd24e commit f45a88c

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

hibernate-core/src/main/java/org/hibernate/action/internal/BulkOperationCleanupAction.java

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public BulkOperationCleanupAction(SharedSessionContractImplementor session, Quer
9191
}
9292
}
9393

94-
this.affectedTableSpaces = spacesList.toArray( new String[ spacesList.size() ] );
94+
this.affectedTableSpaces = spacesList.toArray( new String[ 0 ] );
9595
}
9696

9797
/**
@@ -106,7 +106,7 @@ public BulkOperationCleanupAction(SharedSessionContractImplementor session, Quer
106106
* @param session The session to which this request is tied.
107107
* @param tableSpaces The table spaces.
108108
*/
109-
@SuppressWarnings({ "unchecked" })
109+
@SuppressWarnings( { "unchecked", "rawtypes" } )
110110
public BulkOperationCleanupAction(SharedSessionContractImplementor session, Set tableSpaces) {
111111
final LinkedHashSet<String> spacesList = new LinkedHashSet<>( tableSpaces );
112112

@@ -138,23 +138,26 @@ public BulkOperationCleanupAction(SharedSessionContractImplementor session, Set
138138
}
139139
}
140140

141-
this.affectedTableSpaces = spacesList.toArray( new String[ spacesList.size() ] );
141+
this.affectedTableSpaces = spacesList.toArray( new String[ 0 ] );
142142
}
143143

144144

145145
/**
146-
* Check to determine whether the table spaces reported by an entity
147-
* persister match against the defined affected table spaces.
146+
* Check whether we should consider an entity as affected by the query. This
147+
* defines inclusion of the entity in the clean-up.
148148
*
149149
* @param affectedTableSpaces The table spaces reported to be affected by
150150
* the query.
151151
* @param checkTableSpaces The table spaces (from the entity persister)
152152
* to check against the affected table spaces.
153153
*
154-
* @return True if there are affected table spaces and any of the incoming
155-
* check table spaces occur in that set.
154+
* @return Whether the entity should be considered affected
155+
*
156+
* @implNote An entity is considered to be affected if either (1) the affected table
157+
* spaces are not known or (2) any of the incoming check table spaces occur
158+
* in that set.
156159
*/
157-
private boolean affectedEntity(Set affectedTableSpaces, Serializable[] checkTableSpaces) {
160+
private boolean affectedEntity(Set<?> affectedTableSpaces, Serializable[] checkTableSpaces) {
158161
if ( affectedTableSpaces == null || affectedTableSpaces.isEmpty() ) {
159162
return true;
160163
}
@@ -179,24 +182,21 @@ public BeforeTransactionCompletionProcess getBeforeTransactionCompletionProcess(
179182

180183
@Override
181184
public AfterTransactionCompletionProcess getAfterTransactionCompletionProcess() {
182-
return new AfterTransactionCompletionProcess() {
183-
@Override
184-
public void doAfterTransactionCompletion(boolean success, SharedSessionContractImplementor session) {
185-
for ( EntityCleanup cleanup : entityCleanups ) {
186-
cleanup.release();
187-
}
188-
entityCleanups.clear();
185+
return (success, session) -> {
186+
for ( EntityCleanup cleanup : entityCleanups ) {
187+
cleanup.release();
188+
}
189+
entityCleanups.clear();
189190

190-
for ( NaturalIdCleanup cleanup : naturalIdCleanups ) {
191-
cleanup.release();
192-
}
193-
naturalIdCleanups.clear();
191+
for ( NaturalIdCleanup cleanup : naturalIdCleanups ) {
192+
cleanup.release();
193+
}
194+
naturalIdCleanups.clear();
194195

195-
for ( CollectionCleanup cleanup : collectionCleanups ) {
196-
cleanup.release();
197-
}
198-
collectionCleanups.clear();
196+
for ( CollectionCleanup cleanup : collectionCleanups ) {
197+
cleanup.release();
199198
}
199+
collectionCleanups.clear();
200200
};
201201
}
202202

0 commit comments

Comments
 (0)