Example usage for org.apache.spark.launcher SparkAppHandle addListener

List of usage examples for org.apache.spark.launcher SparkAppHandle addListener

Introduction

In this page you can find the example usage for org.apache.spark.launcher SparkAppHandle addListener.

Prototype

void addListener(Listener l);

Source Link

Document

Adds a listener to be notified of changes to the handle's information.

Usage

From source file:com.thinkbiganalytics.spark.shell.SparkLauncherSparkShellProcess.java

License:Apache License

/**
 * Constructs a {@code SparkLauncherSparkShellProcess} with the specified process.
 *
 * @param handle       the Spark Launcher app handle
 * @param clientId     the client identifier
 * @param clientSecret the client secret
 * @param timeout      the maximum time to wait for the client to be ready
 * @param unit         the time unit of the {@code timeout} argument
 *//* w w w.j  a va  2  s . c o  m*/
public SparkLauncherSparkShellProcess(@Nonnull final SparkAppHandle handle, @Nonnull final String clientId,
        @Nonnull final String clientSecret, final long timeout, @Nonnull final TimeUnit unit) {
    this.handle = handle;
    this.clientId = clientId;
    this.clientSecret = clientSecret;
    readyTime = DateTimeUtils.currentTimeMillis() + unit.toMillis(timeout);

    // Listen for state changes
    handle.addListener(this);
}