@@ -90,7 +90,7 @@ public BulkOperationCleanupAction(SharedSessionContractImplementor session, Quer
90
90
}
91
91
}
92
92
93
- this .affectedTableSpaces = spacesList .toArray ( new String [ spacesList . size () ] );
93
+ this .affectedTableSpaces = spacesList .toArray ( new String [ 0 ] );
94
94
}
95
95
96
96
/**
@@ -105,7 +105,7 @@ public BulkOperationCleanupAction(SharedSessionContractImplementor session, Quer
105
105
* @param session The session to which this request is tied.
106
106
* @param tableSpaces The table spaces.
107
107
*/
108
- @ SuppressWarnings ({ "unchecked" } )
108
+ @ SuppressWarnings ( { "unchecked" , "rawtypes" } )
109
109
public BulkOperationCleanupAction (SharedSessionContractImplementor session , Set tableSpaces ) {
110
110
final LinkedHashSet <String > spacesList = new LinkedHashSet <>();
111
111
spacesList .addAll ( tableSpaces );
@@ -137,23 +137,26 @@ public BulkOperationCleanupAction(SharedSessionContractImplementor session, Set
137
137
}
138
138
}
139
139
140
- this .affectedTableSpaces = spacesList .toArray ( new String [ spacesList . size () ] );
140
+ this .affectedTableSpaces = spacesList .toArray ( new String [ 0 ] );
141
141
}
142
142
143
143
144
144
/**
145
- * Check to determine whether the table spaces reported by an entity
146
- * persister match against the defined affected table spaces .
145
+ * Check whether we should consider an entity as affected by the query. This
146
+ * defines inclusion of the entity in the clean-up .
147
147
*
148
148
* @param affectedTableSpaces The table spaces reported to be affected by
149
149
* the query.
150
150
* @param checkTableSpaces The table spaces (from the entity persister)
151
151
* to check against the affected table spaces.
152
152
*
153
- * @return True if there are affected table spaces and any of the incoming
154
- * check table spaces occur in that set.
153
+ * @return Whether the entity should be considered affected
154
+ *
155
+ * @implNote An entity is considered to be affected if either (1) the affected table
156
+ * spaces are not known or (2) any of the incoming check table spaces occur
157
+ * in that set.
155
158
*/
156
- private boolean affectedEntity (Set affectedTableSpaces , Serializable [] checkTableSpaces ) {
159
+ private boolean affectedEntity (Set <?> affectedTableSpaces , Serializable [] checkTableSpaces ) {
157
160
if ( affectedTableSpaces == null || affectedTableSpaces .isEmpty () ) {
158
161
return true ;
159
162
}
@@ -178,25 +181,21 @@ public BeforeTransactionCompletionProcess getBeforeTransactionCompletionProcess(
178
181
179
182
@ Override
180
183
public AfterTransactionCompletionProcess getAfterTransactionCompletionProcess () {
181
- return new AfterTransactionCompletionProcess () {
182
- @ Override
183
- public void doAfterTransactionCompletion (boolean success , SharedSessionContractImplementor session ) {
184
- for ( EntityCleanup cleanup : entityCleanups ) {
185
- cleanup .release ();
186
- }
187
- entityCleanups .clear ();
188
-
189
- for ( NaturalIdCleanup cleanup : naturalIdCleanups ) {
190
- cleanup .release ();
184
+ return (success , session ) -> {
185
+ for ( EntityCleanup cleanup : entityCleanups ) {
186
+ cleanup .release ();
187
+ }
188
+ entityCleanups .clear ();
191
189
192
- }
193
- entityCleanups .clear ();
190
+ for ( NaturalIdCleanup cleanup : naturalIdCleanups ) {
191
+ cleanup .release ();
192
+ }
193
+ naturalIdCleanups .clear ();
194
194
195
- for ( CollectionCleanup cleanup : collectionCleanups ) {
196
- cleanup .release ();
197
- }
198
- collectionCleanups .clear ();
195
+ for ( CollectionCleanup cleanup : collectionCleanups ) {
196
+ cleanup .release ();
199
197
}
198
+ collectionCleanups .clear ();
200
199
};
201
200
}
202
201
0 commit comments