Sweeper.java [src/csip] Revision: 71821307bfe742c00c6dc582c171224a9ac59935 Date: Fri Apr 21 11:46:19 MDT 2017
/*
* $Id$
*
* This file is part of the Cloud Services Integration Platform (CSIP),
* a Model-as-a-Service framework, API and application suite.
*
* 2012-2017, Olaf David and others, OMSLab, Colorado State University.
*
* OMSLab licenses this file to you under the MIT license.
* See the LICENSE file in the project root for more information.
*/
package csip;
import java.io.File;
import java.util.ArrayList;
import java.util.TimerTask;
import org.apache.commons.io.FileUtils;
/**
*
* @author od
*/
class Sweeper extends TimerTask {
File resultsDir;
String suid;
Sweeper(File resultsDir, String suid) {
this.resultsDir = resultsDir;
this.suid = suid;
}
@Override
public void run() {
// remove all file locks for the workspace
for (File key : new ArrayList<>(Config.wsFileLocks.keySet())) {
if (key.toString().startsWith(resultsDir.toString())) {
Config.wsFileLocks.remove(key);
}
}
Config.getSessionStore().removeSession(suid);
if (resultsDir != null && resultsDir.exists()) {
FileUtils.deleteQuietly(resultsDir);
}
}
}