PersistItStorage.java revision f0a048d41a13eca4cba405da9403c2469ca3d1ea
0N/A * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
0N/A * file and include the License file at legal-notices/CDDLv1_0.txt.
0N/Apublic final class PersistItStorage implements Storage, Backupable, ConfigurationChangeListener<PersistitBackendCfg>,
0N/A return currentKey;
0N/A return currentValue;
0N/A catch (final PersistitException e)
0N/A throw new StorageRuntimeException(e);
0N/A catch (final PersistitException e)
0N/A throw new StorageRuntimeException(e);
0N/A catch (final PersistitException e)
0N/A throw new StorageRuntimeException(e);
0N/A catch (final PersistitException e)
0N/A throw new StorageRuntimeException(e);
0N/A public boolean positionToLastKey()
0N/A catch (final PersistitException e)
0N/A throw new StorageRuntimeException(e);
0N/A private void clearCurrentKeyAndValue()
0N/A private void throwIfUndefined() {
0N/A throw new NoSuchElementException();
0N/A private final ThreadLocal<Map<TreeName, Exchange>> exchanges = new ThreadLocal<Map<TreeName, Exchange>>()
0N/A catch (final PersistitException e)
0N/A throw new StorageRuntimeException(e);
0N/A throw new StorageRuntimeException(e);
0N/A catch (final PersistitException e)
0N/A throw new StorageRuntimeException(e);
0N/A catch (final PersistitException e)
0N/A throw new StorageRuntimeException(e);
0N/A throw new StorageRuntimeException(e);
0N/A catch (final PersistitException e)
0N/A throw new StorageRuntimeException(e);
0N/A catch (final PersistitException e)
0N/A throw new StorageRuntimeException(e);
catch (final PersistitException e)
throw new StorageRuntimeException(e);
catch (final PersistitException e)
throw new StorageRuntimeException(e);
catch (final PersistitException e)
throw new StorageRuntimeException(e);
throw new UnsupportedOperationException();
catch (final Exception e)
throw new StorageRuntimeException(e);
return exchange;
private void release()
private Exchange getNewExchange(final TreeName treeName, final boolean create) throws PersistitException
public PersistItStorage(final PersistitBackendCfg cfg, ServerContext serverContext) throws ConfigException
dbCfg.setVolumeList(asList(new VolumeSpecification(new File(backendDirectory, VOLUME_NAME).getPath(), null,
return dbCfg;
public void close()
catch (final PersistitException e)
throw new IllegalStateException(e);
throw new IllegalStateException(
catch (final PersistitException e)
throw new StorageRuntimeException(e);
getDirectory(),
return result;
catch (final StorageRuntimeException e)
catch (final RollbackException e)
catch (final Exception e)
return new ImporterImpl();
catch (final StorageRuntimeException e)
catch (final RollbackException e)
catch (final Exception e)
public boolean supportsBackupAndRestore()
catch (RemoteException e)
return null;
public boolean isDirectRestore()
catch(IOException e)
LocalizableMessage msg = ERR_CANNOT_RENAME_RESTORE_DIRECTORY.get(restoreDirectory, targetDirectory.getPath());
catch (RemoteException e)
catch (RemoteException e)
public void removeBackup(BackupDirectory backupDirectory, String backupID) throws DirectoryException
return value;
return null;
return cfg.getDBCacheSize() > 0 ? cfg.getDBCacheSize() : memQuota.memPercentToBytes(cfg.getDBCachePercent());
public static boolean isConfigurationAcceptable(PersistitBackendCfg cfg, List<LocalizableMessage> unacceptableReasons,
private static void checkDBDirExistsOrCanCreate(File backendDir, ConfigChangeResult ccr, boolean cleanup)
if (cleanup)
private void setDBDirPermissions(PersistitBackendCfg curCfg, File backendDir) throws ConfigException
catch(Exception e)
private static FilePermission decodeDBDirPermissions(PersistitBackendCfg curCfg) throws ConfigException
catch (Exception e)
return ccr;
ccr.addMessage(NOTE_CONFIG_DB_DIR_REQUIRES_RESTART.get(config.getDBDirectory(), cfg.getDBDirectory()));
return ccr;
getDirectory(),
catch (Exception e)
return ccr;
throw new StorageRuntimeException(ERR_DIRECTORY_INVALID.get(backendDirectory.getPath()).toString());
f.delete();
catch (Exception e)
return storageStatus;
public void diskSpaceRestored(File directory, long lowThresholdInBytes, long fullThresholdInBytes) {