Example usage for com.google.common.io RecursiveDeleteOption ALLOW_INSECURE

List of usage examples for com.google.common.io RecursiveDeleteOption ALLOW_INSECURE

Introduction

In this page you can find the example usage for com.google.common.io RecursiveDeleteOption ALLOW_INSECURE.

Prototype

RecursiveDeleteOption ALLOW_INSECURE

To view the source code for com.google.common.io RecursiveDeleteOption ALLOW_INSECURE.

Click Source Link

Document

Specifies that the recursive delete should not throw an exception when it can't be guaranteed that it can be done securely, without vulnerability to race conditions (i.e.

Usage

From source file:org.apache.pulsar.functions.worker.FunctionActioner.java

public void stopFunction(FunctionRuntimeInfo functionRuntimeInfo) {
    Function.Instance instance = functionRuntimeInfo.getFunctionInstance();
    FunctionMetaData functionMetaData = instance.getFunctionMetaData();
    FunctionDetails details = functionMetaData.getFunctionDetails();
    log.info("{}/{}/{}-{} Stopping function...", details.getTenant(), details.getNamespace(), details.getName(),
            instance.getInstanceId());/*from  w w  w  .ja va2s . com*/
    if (functionRuntimeInfo.getRuntimeSpawner() != null) {
        functionRuntimeInfo.getRuntimeSpawner().close();
        functionRuntimeInfo.setRuntimeSpawner(null);
    }

    // clean up function package
    File pkgDir = new File(workerConfig.getDownloadDirectory(),
            getDownloadPackagePath(functionMetaData, instance.getInstanceId()));

    if (pkgDir.exists()) {
        try {
            MoreFiles.deleteRecursively(Paths.get(pkgDir.toURI()), RecursiveDeleteOption.ALLOW_INSECURE);
        } catch (IOException e) {
            log.warn("Failed to delete package for function: {}",
                    FunctionDetailsUtils.getFullyQualifiedName(functionMetaData.getFunctionDetails()), e);
        }
    }
}