use of org.neo4j.causalclustering.core.state.ClusterStateException in project neo4j by neo4j.
the class UnbindFromClusterCommand method execute.
@Override
public void execute(String[] args) throws IncorrectUsage, CommandFailed {
try {
Config config = loadNeo4jConfig(homeDir, configDir, arguments.parse("database", args));
File dataDirectory = config.get(DatabaseManagementSystemSettings.data_directory);
Path pathToSpecificDatabase = config.get(DatabaseManagementSystemSettings.database_path).toPath();
Validators.CONTAINS_EXISTING_DATABASE.validate(pathToSpecificDatabase.toFile());
confirmTargetDirectoryIsWritable(pathToSpecificDatabase);
ClusterStateDirectory clusterStateDirectory = new ClusterStateDirectory(dataDirectory);
clusterStateDirectory.initialize(outsideWorld.fileSystem());
deleteClusterStateIn(clusterStateDirectory.get().toPath());
} catch (StoreLockException e) {
throw new CommandFailed("Database is currently locked. Please shutdown Neo4j.", e);
} catch (IllegalArgumentException e) {
throw new IncorrectUsage(e.getMessage());
} catch (UnbindFailureException | CannotWriteException | IOException | ClusterStateException e) {
throw new CommandFailed(e.getMessage(), e);
}
}
Aggregations