Skip to content

Commit

Permalink
HHH-11226 Hibernate cache throws NullPointerException during wildfly …
Browse files Browse the repository at this point in the history
…app server startup
  • Loading branch information
rvansa authored and Sanne committed Nov 22, 2016
1 parent a21c086 commit 865d539
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Expand Up @@ -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) {
Expand All @@ -46,7 +45,7 @@ public void addRegion(BaseRegion region) {
/**
* 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<BaseRegion> regions) {
regions.forEach( region -> allRegions.remove( region.getName() ) );
Expand Down
Expand Up @@ -44,7 +44,11 @@ public EvictAllCommand(String regionName) {

@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;
}

Expand Down

0 comments on commit 865d539

Please sign in to comment.