Skip to content

Commit 865d539

Browse files
rvansaSanne
authored andcommitted
HHH-11226 Hibernate cache throws NullPointerException during wildfly app server startup
1 parent a21c086 commit 865d539

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/CacheCommandFactory.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ public class CacheCommandFactory implements ExtendedModuleCommandFactory {
3636
/**
3737
* Add region so that commands can be cleared on shutdown.
3838
*
39-
* @param regionName name of the region
4039
* @param region instance to keep track of
4140
*/
4241
public void addRegion(BaseRegion region) {
@@ -46,7 +45,7 @@ public void addRegion(BaseRegion region) {
4645
/**
4746
* Clear all regions from this command factory.
4847
*
49-
* @param regionNames collection of regions to clear
48+
* @param regions collection of regions to clear
5049
*/
5150
public void clearRegions(Collection<BaseRegion> regions) {
5251
regions.forEach( region -> allRegions.remove( region.getName() ) );

hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/EvictAllCommand.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ public EvictAllCommand(String regionName) {
4444

4545
@Override
4646
public Object perform(InvocationContext ctx) throws Throwable {
47-
region.invalidateRegion();
47+
// When a node is joining the cluster, it may receive an EvictAllCommand before the regions
48+
// are started up. It's safe to ignore such invalidation at this point since no data got in.
49+
if (region != null) {
50+
region.invalidateRegion();
51+
}
4852
return null;
4953
}
5054

0 commit comments

Comments
 (0)