synchronized thread
This commit is contained in:
parent
a1006af44a
commit
897532c88d
|
@ -152,20 +152,21 @@ public class MDStoreController extends AbstractDnetController {
|
||||||
@ApiOperation("Delete expired versions")
|
@ApiOperation("Delete expired versions")
|
||||||
@DeleteMapping("/versions/expired")
|
@DeleteMapping("/versions/expired")
|
||||||
public StatusResponse deleteExpiredVersions() {
|
public StatusResponse deleteExpiredVersions() {
|
||||||
new Thread(() -> {
|
new Thread(this::performDeleteOfExpiredVersions).start();
|
||||||
for (final String versionId : databaseUtils.listExpiredVersions()) {
|
|
||||||
try {
|
|
||||||
final String hdfsPath = databaseUtils.deleteMdStoreVersion(versionId, true);
|
|
||||||
hdfsClient.deletePath(hdfsPath);
|
|
||||||
} catch (final MDStoreManagerException e) {
|
|
||||||
log.warn("Error deleteting version " + versionId, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
|
|
||||||
return StatusResponse.DELETING;
|
return StatusResponse.DELETING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private synchronized void performDeleteOfExpiredVersions() {
|
||||||
|
for (final String versionId : databaseUtils.listExpiredVersions()) {
|
||||||
|
try {
|
||||||
|
final String hdfsPath = databaseUtils.deleteMdStoreVersion(versionId, true);
|
||||||
|
hdfsClient.deletePath(hdfsPath);
|
||||||
|
} catch (final MDStoreManagerException e) {
|
||||||
|
log.warn("Error deleteting version " + versionId, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("Fix the inconsistencies on HDFS")
|
@ApiOperation("Fix the inconsistencies on HDFS")
|
||||||
@GetMapping("/hdfs/inconsistencies")
|
@GetMapping("/hdfs/inconsistencies")
|
||||||
public Set<String> fixHdfsInconsistencies(
|
public Set<String> fixHdfsInconsistencies(
|
||||||
|
|
Loading…
Reference in New Issue