public static SharedFileDescriptorFactory create(String prefix,
      String paths[]) throws IOException {
    String loadingFailureReason = getLoadingFailureReason();
    if (loadingFailureReason != null) {
      throw new IOException(loadingFailureReason);
    }
    if (paths.length == 0) {
      throw new IOException("no SharedFileDescriptorFactory paths were " +
          "configured.");
    }
    StringBuilder errors = new StringBuilder();
    String strPrefix = "";
    for (String path : paths) {
      try {
        FileInputStream fis = 
            new FileInputStream(createDescriptor0(prefix + "test", path, 1));
        fis.close();
        deleteStaleTemporaryFiles0(prefix, path);
        return new SharedFileDescriptorFactory(prefix, path);
      } catch (IOException e) {
        errors.append(strPrefix).append("Error creating file descriptor in ").
               append(path).append(": ").append(e.getMessage());
        strPrefix = ", ";
      }
    }
    throw new IOException(errors.toString());
  }
@Test(timeout=10000)
  public void testCleanupRemainders() throws Exception {
    Assume.assumeTrue(NativeIO.isAvailable());
    Assume.assumeTrue(SystemUtils.IS_OS_UNIX);
    File path = new File(TEST_BASE, "testCleanupRemainders");
    path.mkdirs();
    String remainder1 = path.getAbsolutePath() + 
        Path.SEPARATOR + "woot2_remainder1";
    String remainder2 = path.getAbsolutePath() +
        Path.SEPARATOR + "woot2_remainder2";
    createTempFile(remainder1);
    createTempFile(remainder2);
    SharedFileDescriptorFactory.create("woot2_", 
        new String[] { path.getAbsolutePath() });
    // creating the SharedFileDescriptorFactory should have removed 
    // the remainders
    Assert.assertFalse(new File(remainder1).exists());
    Assert.assertFalse(new File(remainder2).exists());
    FileUtil.fullyDelete(path);
  }