code: private void removeEntries(HistoryKey pKey) {
          if (pKey.isMBeanPattern()) {
              patterns.remove(pKey);
              List<HistoryKey> toRemove = new ArrayList<HistoryKey>();
              for (HistoryKey key : historyStore.keySet()) {
                  if (pKey.matches(key)) {
                      toRemove.add(key);
                  }
              }
              // Avoid concurrent modification exceptions
              for (HistoryKey key : toRemove) {
                  historyStore.remove(key);
              }
          } else {
              HistoryEntry entry = historyStore.get(pKey);
              if (entry != null) {
                  historyStore.remove(pKey);
              }
          }
      }
docs: Remove entries