} catch (IOException ioe) { throw ServiceException.FAILURE("exception initiating scan", ioe);
mScanInProgress = true; clearIndex(); RemoteManager rm = RemoteManager.getRemoteManager(server); rm.executeBackground(RemoteCommands.ZMQSTAT + " " + queueName, new QueueHandler());
    public void startScan(Server server, String queueName) throws ServiceException {        try {            synchronized (mScanLock) {                if (mScanInProgress) {                    // One day, we should interrupt the scan.                    throw ServiceException.FAILURE("scan already in progress and can not be interrupted", null);                }                mScanInProgress = true;                                        if (mIndexPath.exists()) {                    if (!mIndexPath.isDirectory()) {                        throw new IOException("directory for mail queue cache index is a file: " + mIndexPath);                    }                    if (ZimbraLog.rmgmt.isDebugEnabled()) ZimbraLog.rmgmt.debug("clearing index directory");                    File[] files = mIndexPath.listFiles();                    for (File f : files) {                        if (!f.isDirectory()) {                            if (ZimbraLog.rmgmt.isDebugEnabled()) ZimbraLog.rmgmt.debug("deleting file: " + f);                            f.delete();                        }                    }                }                                        RemoteManager rm = RemoteManager.getRemoteManager(server);                rm.executeBackground(RemoteCommands.ZMQSTAT + " " + queueName, new QueueHandler());            }        } catch (IOException ioe) {            throw ServiceException.FAILURE("exception initiating scan", ioe);        }    }