Skip to content

Commit 204dc9f

Browse files
sebersoleSanne
authored andcommitted
Fixed Javadoc for BulkOperationCleanupAction.affectedEntity
1 parent c4eacbb commit 204dc9f

File tree

1 file changed

+23
-24
lines changed

1 file changed

+23
-24
lines changed

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

+23-24
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public BulkOperationCleanupAction(SharedSessionContractImplementor session, Quer
9090
}
9191
}
9292

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

9696
/**
@@ -105,7 +105,7 @@ public BulkOperationCleanupAction(SharedSessionContractImplementor session, Quer
105105
* @param session The session to which this request is tied.
106106
* @param tableSpaces The table spaces.
107107
*/
108-
@SuppressWarnings({ "unchecked" })
108+
@SuppressWarnings( { "unchecked", "rawtypes" } )
109109
public BulkOperationCleanupAction(SharedSessionContractImplementor session, Set tableSpaces) {
110110
final LinkedHashSet<String> spacesList = new LinkedHashSet<>();
111111
spacesList.addAll( tableSpaces );
@@ -137,23 +137,26 @@ public BulkOperationCleanupAction(SharedSessionContractImplementor session, Set
137137
}
138138
}
139139

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

143143

144144
/**
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.
147147
*
148148
* @param affectedTableSpaces The table spaces reported to be affected by
149149
* the query.
150150
* @param checkTableSpaces The table spaces (from the entity persister)
151151
* to check against the affected table spaces.
152152
*
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.
155158
*/
156-
private boolean affectedEntity(Set affectedTableSpaces, Serializable[] checkTableSpaces) {
159+
private boolean affectedEntity(Set<?> affectedTableSpaces, Serializable[] checkTableSpaces) {
157160
if ( affectedTableSpaces == null || affectedTableSpaces.isEmpty() ) {
158161
return true;
159162
}
@@ -178,25 +181,21 @@ public BeforeTransactionCompletionProcess getBeforeTransactionCompletionProcess(
178181

179182
@Override
180183
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();
191189

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

195-
for ( CollectionCleanup cleanup : collectionCleanups ) {
196-
cleanup.release();
197-
}
198-
collectionCleanups.clear();
195+
for ( CollectionCleanup cleanup : collectionCleanups ) {
196+
cleanup.release();
199197
}
198+
collectionCleanups.clear();
200199
};
201200
}
202201

0 commit comments

Comments
 (0)