| | |
| | | import java.util.concurrent.atomic.AtomicLong; |
| | | import org.opends.server.api.DirectoryThread; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.DebugLogLevel; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | |
| | | import org.opends.server.types.Entry; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import static org.opends.server.loggers.ErrorLogger.logError; |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | |
| | |
| | | */ |
| | | class EntryCachePreloader |
| | | { |
| | | /** |
| | | * The tracer object for the debug logger. |
| | | */ |
| | | private static final DebugTracer TRACER = getTracer(); |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * BackendImpl object. |
| | |
| | | jeb.getBackendID(), processedEntries.get()); |
| | | logError(message); |
| | | } catch (InterruptedException ex) { |
| | | if (debugEnabled()) { |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, ex); |
| | | } |
| | | logger.traceException(ex); |
| | | // Interrupt the collector. |
| | | collector.interrupt(); |
| | | // Interrupt all preload threads. |
| | |
| | | DirectoryServer.getEntryCache().putEntry(entry, jeb, entryID); |
| | | processedEntries.getAndIncrement(); |
| | | } catch (Exception ex) { |
| | | if (debugEnabled()) { |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, ex); |
| | | } |
| | | logger.traceException(ex); |
| | | LocalizableMessage message = ERR_CACHE_PRELOAD_ENTRY_FAILED.get( |
| | | entry.getName().toNormalizedString(), |
| | | (ex.getCause() != null ? ex.getCause().getMessage() : |
| | |
| | | try { |
| | | cursor.close(); |
| | | } catch (DatabaseException de) { |
| | | if (debugEnabled()) { |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, de); |
| | | } |
| | | logger.traceException(de); |
| | | } |
| | | status = OperationStatus.SUCCESS; |
| | | cursor = null; |
| | |
| | | } catch (InterruptedException e) { |
| | | return; |
| | | } catch (Exception e) { |
| | | if (debugEnabled()) { |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | logger.traceException(e); |
| | | } |
| | | } |
| | | } finally { |
| | |
| | | try { |
| | | cursor.close(); |
| | | } catch (DatabaseException de) { |
| | | if (debugEnabled()) { |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, de); |
| | | } |
| | | logger.traceException(de); |
| | | } |
| | | } |
| | | } |