public void close() {
        directoryCache.close();
        fileDistributionFactory.close();
        try {
            zkCacheExecutor.shutdown();
            checkForRemovedApplicationsService.shutdown();
            zkApplicationWatcherExecutor.shutdownAndWait();
            zkSessionWatcherExecutor.shutdownAndWait();
            zkCacheExecutor.awaitTermination(50, TimeUnit.SECONDS);
            checkForRemovedApplicationsService.awaitTermination(50, TimeUnit.SECONDS);
        }
        catch (InterruptedException e) {
            log.log(Level.WARNING, "Interrupted while shutting down.", e);
            Thread.currentThread().interrupt();
        }
    }
@Test
    public void testFailingBootstrap() {
        tenantRepository.close(); // stop using the one setup in Before method

        expectedException.expect(RuntimeException.class);
        expectedException.expectMessage("Could not create all tenants when bootstrapping, failed to create: [default]");
        new FailingDuringBootstrapTenantRepository(configserverConfig);
    }