/** {@inheritDoc} */ @Override() public long numSubordinates(DN entryDN, boolean subtree) throws DirectoryException { EntryContainer ec; if (rootContainer != null) { ec = rootContainer.getEntryContainer(entryDN); } else { Message message = ERR_ROOT_CONTAINER_NOT_INITIALIZED.get(getBackendID()); throw new DirectoryException(DirectoryServer.getServerErrorResultCode(), message); } if (ec == null) { return -1; } readerBegin(); ec.sharedLock.lock(); try { long count = ec.getNumSubordinates(entryDN, subtree); if (count == Long.MAX_VALUE) { // The index entry limit has exceeded and there is no count maintained. return -1; } return count; } catch (DatabaseException e) { if (debugEnabled()) { TRACER.debugCaught(DebugLogLevel.ERROR, e); } throw createDirectoryException(e); } finally { ec.sharedLock.unlock(); readerEnd(); } }