| | |
| | | private static final int IMPORT_DB_CACHE_SIZE = 4 * MB; |
| | | |
| | | private static final double MAX_SLEEP_ON_RETRY_MS = 50.0; |
| | | |
| | | private static final String VOLUME_NAME = "dj"; |
| | | |
| | | private static final String JOURNAL_NAME = VOLUME_NAME + "_journal"; |
| | | |
| | | /** The buffer / page size used by the PersistIt storage. */ |
| | | private static final int BUFFER_SIZE = 16 * 1024; |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public boolean isDefined() { |
| | | public boolean isDefined() |
| | | { |
| | | return exchange.getValue().isDefined(); |
| | | } |
| | | |
| | |
| | | currentValue = null; |
| | | } |
| | | |
| | | private void throwIfUndefined() { |
| | | if (!isDefined()) { |
| | | private void throwIfUndefined() |
| | | { |
| | | if (!isDefined()) |
| | | { |
| | | throw new NoSuchElementException(); |
| | | } |
| | | } |
| | |
| | | /** PersistIt implementation of the {@link WriteableTransaction} interface. */ |
| | | private final class WriteableStorageImpl implements StorageImpl |
| | | { |
| | | private static final String DUMMY_RECORD = "_DUMMY_RECORD_"; |
| | | private final Map<TreeName, Exchange> exchanges = new HashMap<>(); |
| | | private final String DUMMY_RECORD = "_DUMMY_RECORD_"; |
| | | |
| | | @Override |
| | | public void put(final TreeName treeName, final ByteSequence key, final ByteSequence value) |
| | |
| | | private Volume volume; |
| | | private PDBBackendCfg config; |
| | | private DiskSpaceMonitor diskMonitor; |
| | | private PDBMonitor pdbMonitor; |
| | | private PDBMonitor monitor; |
| | | private MemoryQuota memQuota; |
| | | private StorageStatus storageStatus = StorageStatus.working(); |
| | | |
| | |
| | | { |
| | | if (db != null) |
| | | { |
| | | DirectoryServer.deregisterMonitorProvider(pdbMonitor); |
| | | pdbMonitor = null; |
| | | DirectoryServer.deregisterMonitorProvider(monitor); |
| | | monitor = null; |
| | | try |
| | | { |
| | | db.close(); |
| | |
| | | |
| | | db.initialize(); |
| | | volume = db.loadVolume(VOLUME_NAME); |
| | | pdbMonitor = new PDBMonitor(config.getBackendId() + " PDB Database", db); |
| | | DirectoryServer.registerMonitorProvider(pdbMonitor); |
| | | monitor = new PDBMonitor(config.getBackendId() + " PDB Database", db); |
| | | DirectoryServer.registerMonitorProvider(monitor); |
| | | } |
| | | catch(final InUseException e) { |
| | | throw new StorageInUseException(e); |