@Override
    public void saveAll(Iterable<MetricEntity> metrics) {
        if (metrics == null) {
            return;
        }
        readWriteLock.writeLock().lock();
        try {
            metrics.forEach(this::save);
        } finally {
            readWriteLock.writeLock().unlock();
        }
    }
@Test
    public void testSaveAll() {
        List<MetricEntity> entities = new ArrayList<>(10000);
        for (int i = 0; i < 10000; i++) {
            MetricEntity entry = new MetricEntity();
            entry.setApp("testSaveAll");
            entry.setResource("testResource" + i);
            entry.setTimestamp(new Date(System.currentTimeMillis()));
            entry.setPassQps(1L);
            entry.setExceptionQps(1L);
            entry.setBlockQps(0L);
            entry.setSuccessQps(1L);
            entities.add(entry);
        }
        inMemoryMetricsRepository.saveAll(entities);
        List<String> result = inMemoryMetricsRepository.listResourcesOfApp("testSaveAll");
        Assert.assertTrue(result.size() == entities.size());
    }