| | |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | |
| | | import com.sleepycat.je.*; |
| | | import java.io.Closeable; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.util.ServerConstants; |
| | | import org.opends.server.util.StaticUtils; |
| | | |
| | | import com.sleepycat.je.*; |
| | | |
| | | /** |
| | | * This class is a wrapper around the JE database object and provides basic |
| | | * read and write methods for entries. |
| | | */ |
| | | public abstract class DatabaseContainer |
| | | public abstract class DatabaseContainer implements Closeable |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | |
| | | * created and used to perform the open. |
| | | * |
| | | * @throws DatabaseException if a JE database error occurs while |
| | | * openning the index. |
| | | * opening the index. |
| | | */ |
| | | public void open() throws DatabaseException |
| | | { |
| | |
| | | * database container. |
| | | * |
| | | * The database container should not be closed while other processes |
| | | * aquired the container. The container should not be closed |
| | | * acquired the container. The container should not be closed |
| | | * while cursors handles into the database remain open, or |
| | | * transactions that include operations on the database have not yet |
| | | * been commited or aborted. |
| | | * been committed or aborted. |
| | | * |
| | | * The container may not be accessed again after this method is |
| | | * called, regardless of the method's success or failure. |
| | | * |
| | | * @throws DatabaseException if an error occurs. |
| | | */ |
| | | synchronized void close() throws DatabaseException |
| | | @Override |
| | | synchronized public void close() throws DatabaseException |
| | | { |
| | | if(dbConfig.getDeferredWrite()) |
| | | { |
| | |
| | | throws DatabaseException |
| | | { |
| | | return database.openCursor(cursorConfig); |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | * Get a string representation of this object. |
| | | * @return return A string representation of this object. |
| | | */ |
| | | @Override |
| | | public String toString() |
| | | { |
| | | return name; |
| | |
| | | { |
| | | StringBuilder builder = new StringBuilder(); |
| | | builder.append(" ("); |
| | | builder.append(status.toString()); |
| | | builder.append(status); |
| | | builder.append(")"); |
| | | builder.append(" db="); |
| | | try |
| | |
| | | } |
| | | catch (DatabaseException de) |
| | | { |
| | | builder.append(de.toString()); |
| | | builder.append(de); |
| | | } |
| | | if (txn != null) |
| | | { |
| | |
| | | } |
| | | catch (DatabaseException de) |
| | | { |
| | | builder.append(de.toString()); |
| | | builder.append(de); |
| | | } |
| | | } |
| | | else |
| | |
| | | return builder.toString(); |
| | | } |
| | | |
| | | |
| | | } |