code: synchronized IndexReader[] getIndexReaders(String[] indexNames, IndexListener listener) throws IOException
     {
        Set<String> names = new HashSet<String>(Arrays.asList(indexNames));
        Map<ReadOnlyIndexReader, PersistentIndex> indexReaders = new HashMap<ReadOnlyIndexReader, PersistentIndex>();
  
        try
        {
           for (Iterator<PersistentIndex> it = indexes.iterator(); it.hasNext();)
           {
              PersistentIndex index = it.next();
              if (names.contains(index.getName()))
              {
                 indexReaders.put(index.getReadOnlyIndexReader(listener), index);
              }
           }
        }
        catch (IOException e)
        {
           // release readers obtained so far
           for (Iterator<Entry<ReadOnlyIndexReader, PersistentIndex>> it = indexReaders.entrySet().iterator(); it
              .hasNext();)
           {
              Map.Entry<ReadOnlyIndexReader, PersistentIndex> entry = it.next();
              final ReadOnlyIndexReader reader = entry.getKey();
              try
              {
                 SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Object>()
                 {
                    public Object run() throws Exception
                    {
                       reader.release();
                       return null;
                    }
                 });
              }
              catch (IOException ex)
              {
                 LOG.warn("Exception releasing index reader: " + ex);
              }
              (entry.getValue()).resetListener();
           }
           throw e;
        }
  
        return indexReaders.keySet().toArray(new IndexReader[indexReaders.size()]);
     }
docs: Returns <code>IndexReader</code>s for the indexes named
  <code>indexNames</code>. An <code>IndexListener</code> is registered and
  notified when documents are deleted from one of the indexes in
  <code>indexNames</code>.
  <br>
  Note: the number of <code>IndexReaders</code> returned by this method is
  not necessarily the same as the number of index names passed. An index
  might have been deleted and is not reachable anymore.
  
  @param indexNames
  the names of the indexes for which to obtain readers.
  @param listener
  the listener to notify when documents are deleted.
  @return the <code>IndexReaders</code>.
  @throws IOException
  if an error occurs acquiring the index readers.