Search in sources :

Example 1 with CannotClearSiddhiAppStateException

use of io.siddhi.core.exception.CannotClearSiddhiAppStateException in project siddhi by wso2.

the class FileSystemPersistenceStore method clearAllRevisions.

@Override
public void clearAllRevisions(String siddhiAppName) {
    File targetDirectory = new File(folder + File.separator + siddhiAppName);
    File[] files = targetDirectory.listFiles();
    if (files == null || files.length == 0) {
        log.info("No revisions were found to delete for the Siddhi App " + siddhiAppName);
        return;
    }
    for (File file : files) {
        if (file.exists()) {
            if (!file.delete()) {
                log.error("file is not deleted successfully : " + file.getName());
                throw new CannotClearSiddhiAppStateException("Persistence state " + "file is not deleted : " + file.getName());
            }
        }
    }
}
Also used : CannotClearSiddhiAppStateException(io.siddhi.core.exception.CannotClearSiddhiAppStateException) File(java.io.File)

Example 2 with CannotClearSiddhiAppStateException

use of io.siddhi.core.exception.CannotClearSiddhiAppStateException in project siddhi by wso2.

the class IncrementalFileSystemPersistenceStore method clearAllRevisions.

@Override
public void clearAllRevisions(String siddhiAppName) {
    File dir = new File(folder + File.separator + siddhiAppName);
    File[] files = dir.listFiles();
    if (files == null || files.length == 0) {
        log.info("No revisions were found to delete for the Siddhi App " + siddhiAppName);
        return;
    }
    for (File file : files) {
        if (file.exists()) {
            if (!file.delete()) {
                log.error("file is not deleted successfully : " + file.getName());
                throw new CannotClearSiddhiAppStateException("Persistence state " + "file is not deleted : " + file.getName());
            }
        }
    }
}
Also used : CannotClearSiddhiAppStateException(io.siddhi.core.exception.CannotClearSiddhiAppStateException) File(java.io.File)

Aggregations

CannotClearSiddhiAppStateException (io.siddhi.core.exception.CannotClearSiddhiAppStateException)2 File (java.io.File)2