/** * Process an interest request of type {@link InterestType#REGULAR_EXPRESSION} */ private static void handleRegEx(LocalRegion region, String regex, InterestResultPolicy policy, ServerConnection servConn) throws IOException { if (region instanceof PartitionedRegion) { // too bad java doesn't provide another way to do this... handleRegExPR((PartitionedRegion) region, regex, policy, servConn); return; } List keyList = new ArrayList(MAXIMUM_CHUNK_SIZE); // Handle the regex pattern if (region != null) { Pattern keyPattern = Pattern.compile(regex); for (Object entryKey : region.keySet(sendTombstonesInRIResults(servConn, policy))) { if (!(entryKey instanceof String)) { // key is not a String, cannot apply regex to this entry continue; } if (!keyPattern.matcher((String) entryKey).matches()) { // key does not match the regex, this entry should not be returned. continue; } appendInterestResponseKey(region, regex, entryKey, keyList, servConn); } } // Send the last chunk (the only chunk for individual and list keys) // always send it back, even if the list is of zero size. sendRegisterInterestResponseChunk(region, regex, keyList, true, servConn); }