@@ -91,7 +91,7 @@ public BulkOperationCleanupAction(SharedSessionContractImplementor session, Quer
91
91
}
92
92
}
93
93
94
- this .affectedTableSpaces = spacesList .toArray ( new String [ spacesList . size () ] );
94
+ this .affectedTableSpaces = spacesList .toArray ( new String [ 0 ] );
95
95
}
96
96
97
97
/**
@@ -106,7 +106,7 @@ public BulkOperationCleanupAction(SharedSessionContractImplementor session, Quer
106
106
* @param session The session to which this request is tied.
107
107
* @param tableSpaces The table spaces.
108
108
*/
109
- @ SuppressWarnings ({ "unchecked" } )
109
+ @ SuppressWarnings ( { "unchecked" , "rawtypes" } )
110
110
public BulkOperationCleanupAction (SharedSessionContractImplementor session , Set tableSpaces ) {
111
111
final LinkedHashSet <String > spacesList = new LinkedHashSet <>( tableSpaces );
112
112
@@ -138,23 +138,26 @@ public BulkOperationCleanupAction(SharedSessionContractImplementor session, Set
138
138
}
139
139
}
140
140
141
- this .affectedTableSpaces = spacesList .toArray ( new String [ spacesList . size () ] );
141
+ this .affectedTableSpaces = spacesList .toArray ( new String [ 0 ] );
142
142
}
143
143
144
144
145
145
/**
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 .
148
148
*
149
149
* @param affectedTableSpaces The table spaces reported to be affected by
150
150
* the query.
151
151
* @param checkTableSpaces The table spaces (from the entity persister)
152
152
* to check against the affected table spaces.
153
153
*
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.
156
159
*/
157
- private boolean affectedEntity (Set affectedTableSpaces , Serializable [] checkTableSpaces ) {
160
+ private boolean affectedEntity (Set <?> affectedTableSpaces , Serializable [] checkTableSpaces ) {
158
161
if ( affectedTableSpaces == null || affectedTableSpaces .isEmpty () ) {
159
162
return true ;
160
163
}
@@ -179,24 +182,21 @@ public BeforeTransactionCompletionProcess getBeforeTransactionCompletionProcess(
179
182
180
183
@ Override
181
184
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 ();
189
190
190
- for ( NaturalIdCleanup cleanup : naturalIdCleanups ) {
191
- cleanup .release ();
192
- }
193
- naturalIdCleanups .clear ();
191
+ for ( NaturalIdCleanup cleanup : naturalIdCleanups ) {
192
+ cleanup .release ();
193
+ }
194
+ naturalIdCleanups .clear ();
194
195
195
- for ( CollectionCleanup cleanup : collectionCleanups ) {
196
- cleanup .release ();
197
- }
198
- collectionCleanups .clear ();
196
+ for ( CollectionCleanup cleanup : collectionCleanups ) {
197
+ cleanup .release ();
199
198
}
199
+ collectionCleanups .clear ();
200
200
};
201
201
}
202
202
0 commit comments