Source:
<code>void doClear(RegionEventImpl regionEvent, boolean cacheWrite) { String lockName = CLEAR_OPERATION + partitionedRegion.getName(); long clearStartTime = 0; try { acquireDistributedClearLock(lockName); clearStartTime = System.nanoTime(); assignAllPrimaryBuckets(); if (cacheWrite) { invokeCacheWriter(regionEvent); } boolean acquireClearLockForNotification = (partitionedRegion.hasAnyClientsInterested() || partitionedRegion.hasListener()); if (acquireClearLockForNotification) { obtainLockForClear(regionEvent); <START> } <END> try { Set<Integer> bucketsCleared = clearRegion(regionEvent); if (!partitionedRegion.allServerVersionsSupportPartitionRegionClear()) { throw new PartitionedRegionVersionException(); } if (partitionedRegion.getTotalNumberOfBuckets() != bucketsCleared.size()) { String message = "Unable to clear all the buckets from the partitioned region " + partitionedRegion.getName() + ", either data (buckets) moved or member departed."; logger.warn(message + " expected to clear number of buckets: " + partitionedRegion.getTotalNumberOfBuckets() + " actual cleared: " + bucketsCleared.size()); throw new PartitionedRegionPartialClearException(message); } } finally { if (acquireClearLockForNotification) { releaseLockForClear(regionEvent); } } } finally { releaseDistributedClearLock(lockName); CachePerfStats stats = partitionedRegion.getRegionCachePerfStats(); if (stats != null) { partitionedRegion.getRegionCachePerfStats() .incPartitionedRegionClearTotalDuration(System.nanoTime() - clearStartTime); } } }</code><technical_language>Optional: allServerVersionsSupportPartitionRegionClear named return a list of incompatible servers. format a message for PartitionedRegionVersionException lists out server names incompatible</technical_language>

Target:
void doClear(RegionEventImpl regionEvent, boolean cacheWrite) { String lockName = CLEAR_OPERATION + partitionedRegion.getName(); long clearStartTime = 0; allServerVersionsSupportPartitionRegionClear(); try { acquireDistributedClearLock(lockName); clearStartTime = System.nanoTime(); assignAllPrimaryBuckets(); if (cacheWrite) { invokeCacheWriter(regionEvent); } boolean acquireClearLockForNotification = (partitionedRegion.hasAnyClientsInterested() || partitionedRegion.hasListener()); if (acquireClearLockForNotification) { obtainLockForClear(regionEvent); } try { Set<Integer> bucketsCleared = clearRegion(regionEvent); if (partitionedRegion.getTotalNumberOfBuckets() != bucketsCleared.size()) { String message = "Unable to clear all the buckets from the partitioned region " + partitionedRegion.getName() + ", either data (buckets) moved or member departed."; logger.warn(message + " expected to clear number of buckets: " + partitionedRegion.getTotalNumberOfBuckets() + " actual cleared: " + bucketsCleared.size()); throw new PartitionedRegionPartialClearException(message); } } finally { if (acquireClearLockForNotification) { releaseLockForClear(regionEvent); } } } finally { releaseDistributedClearLock(lockName); CachePerfStats stats = partitionedRegion.getRegionCachePerfStats(); if (stats != null) { partitionedRegion.getRegionCachePerfStats() .incPartitionedRegionClearTotalDuration(System.nanoTime() - clearStartTime); } } }