@Override
    public void close() throws Exception {
        if (aggregateLocalUsagePeriodicTask != null) {
            aggregateLocalUsagePeriodicTask.cancel(true);
        }
        if (calculateQuotaPeriodicTask != null) {
            calculateQuotaPeriodicTask.cancel(true);
        }
        resourceGroupsMap.clear();
        tenantToRGsMap.clear();
        namespaceToRGsMap.clear();
        topicProduceStats.clear();
        topicConsumeStats.clear();
    }
@Test
    public void testClose() throws Exception {
        ResourceGroupService service = new ResourceGroupService(pulsar, TimeUnit.MILLISECONDS, null, null);
        service.close();
        Assert.assertTrue(service.getAggregateLocalUsagePeriodicTask().isCancelled());
        Assert.assertTrue(service.getCalculateQuotaPeriodicTask().isCancelled());
    }