Example usage for com.amazonaws.services.elasticmapreduce AmazonElasticMapReduceClient setTerminationProtection

List of usage examples for com.amazonaws.services.elasticmapreduce AmazonElasticMapReduceClient setTerminationProtection

Introduction

In this page you can find the example usage for com.amazonaws.services.elasticmapreduce AmazonElasticMapReduceClient setTerminationProtection.

Prototype

@Override
public SetTerminationProtectionResult setTerminationProtection(SetTerminationProtectionRequest request) 

Source Link

Document

SetTerminationProtection locks a cluster (job flow) so the EC2 instances in the cluster cannot be terminated by user intervention, an API call, or in the event of a job-flow error.

Usage

From source file:org.finra.dm.dao.impl.EmrOperationsImpl.java

License:Apache License

/**
 * Terminate EMR cluster, overrides terminate protection if requested.
 *//*w w w .j av  a  2  s .  c  om*/
@Override
public void terminateEmrCluster(AmazonElasticMapReduceClient emrClient, String clusterId,
        boolean overrideTerminationProtection) {
    // Override terminate protection if requested.
    if (overrideTerminationProtection) {
        // Set termination protection
        emrClient.setTerminationProtection(new SetTerminationProtectionRequest().withJobFlowIds(clusterId)
                .withTerminationProtected(false));
    }

    // Terminate the job flow
    emrClient.terminateJobFlows(new TerminateJobFlowsRequest().withJobFlowIds(clusterId));
}