diff --git a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/CacheCommandFactory.java b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/CacheCommandFactory.java index 3a90b655fc..eb3f10f346 100644 --- a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/CacheCommandFactory.java +++ b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/CacheCommandFactory.java @@ -36,7 +36,6 @@ public class CacheCommandFactory implements ExtendedModuleCommandFactory { /** * Add region so that commands can be cleared on shutdown. * - * @param regionName name of the region * @param region instance to keep track of */ public void addRegion(BaseRegion region) { @@ -46,7 +45,7 @@ public class CacheCommandFactory implements ExtendedModuleCommandFactory { /** * Clear all regions from this command factory. * - * @param regionNames collection of regions to clear + * @param regions collection of regions to clear */ public void clearRegions(Collection regions) { regions.forEach( region -> allRegions.remove( region.getName() ) ); diff --git a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/EvictAllCommand.java b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/EvictAllCommand.java index 9f17d70f78..b22085369d 100644 --- a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/EvictAllCommand.java +++ b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/EvictAllCommand.java @@ -44,7 +44,11 @@ public class EvictAllCommand extends BaseRpcCommand { @Override public Object perform(InvocationContext ctx) throws Throwable { - region.invalidateRegion(); + // When a node is joining the cluster, it may receive an EvictAllCommand before the regions + // are started up. It's safe to ignore such invalidation at this point since no data got in. + if (region != null) { + region.invalidateRegion(); + } return null; }