| | |
| | | |
| | | import static org.opends.messages.JebMessages.*; |
| | | import static org.opends.server.loggers.ErrorLogger.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugEnabled; |
| | | import static org.opends.server.loggers.debug.DebugLogger.getTracer; |
| | | import static org.opends.server.util.DynamicConstants.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | |
| | | import org.opends.server.config.ConfigException; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.extensions.DiskSpaceMonitor; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.util.LDIFReader; |
| | | import org.opends.server.util.Platform; |
| | |
| | | */ |
| | | public final class Importer implements DiskSpaceMonitorHandler |
| | | { |
| | | /** |
| | | * The tracer object for the debug logger. |
| | | */ |
| | | private static final DebugTracer TRACER = getTracer(); |
| | | |
| | | private static final int TIMER_INTERVAL = 10000; |
| | | private static final int KB = 1024; |
| | | private static final int MB = (KB * KB); |
| | |
| | | // Scratch writers allocate 4 buffers per index as well. |
| | | final int totalPhaseOneBufferCount = |
| | | phaseOneBufferCount + (4 * indexCount); |
| | | bufferSize = (int) (phaseOneBufferMemory / totalPhaseOneBufferCount); |
| | | long longBufferSize = phaseOneBufferMemory / totalPhaseOneBufferCount; |
| | | // We need (2 * bufferSize) to fit in an int for the insertByteStream |
| | | // and deleteByteStream constructors. |
| | | bufferSize = (int) Math.min(longBufferSize, Integer.MAX_VALUE / 2); |
| | | |
| | | if (bufferSize > MAX_BUFFER_SIZE) |
| | | { |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | Message message = |
| | | ERR_JEB_IMPORT_LDIF_REBUILD_INDEX_TASK_ERR.get(e.getMessage()); |
| | | if (debugEnabled()) |
| | | { |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | Message message = ERR_JEB_IMPORT_LDIF_REBUILD_INDEX_TASK_ERR.get( |
| | | stackTraceToSingleLineString(e)); |
| | | logError(message); |
| | | isCanceled = true; |
| | | throw e; |