public void testParallelDifferentStores() throws Exception {
    List<XmlMetaStore> stores = new ArrayList<XmlMetaStore>();
    final List<Throwable> exceptions = new ArrayList<Throwable>();
    // Run the test against the XML metadata store.
    //
    try {
      for (int i = 0; i < 10; i++) {
        stores.add(new XmlMetaStore());
      }

      List<Thread> threads = new ArrayList<Thread>();
      for (final IMetaStore store : stores) {
        Thread thread =
            new Thread() {
              public void run() {
                try {
                  testFunctionality(store);
                } catch (Throwable e) {
                  exceptions.add(e);
                }
              }
            };
        threads.add(thread);
        thread.start();
      }

      for (Thread thread : threads) {
        thread.join();
      }
    } finally {
      for (XmlMetaStore store : stores) {
        FileUtil.cleanFolder(new File(store.getRootFolder()).getParentFile(), true);
      }
    }

    if (!exceptions.isEmpty()) {
      for (Throwable e : exceptions) {
        e.printStackTrace(System.err);
      }
      fail(exceptions.size() + " exceptions encountered during parallel store/retrieve");
    }
  }
 @Override
 protected void tearDown() throws Exception {
   super.tearDown();
   FileUtil.cleanFolder(new File(metaStore.getRootFolder()).getParentFile(), true);
 }