Example usage for org.apache.hadoop.yarn.api.records QueueInfo getQueueState

List of usage examples for org.apache.hadoop.yarn.api.records QueueInfo getQueueState

Introduction

In this page you can find the example usage for org.apache.hadoop.yarn.api.records QueueInfo getQueueState.

Prototype

@Public
@Stable
public abstract QueueState getQueueState();

Source Link

Document

Get the QueueState of the queue.

Usage

From source file:co.cask.cdap.operations.yarn.YarnQueues.java

License:Apache License

@Override
public synchronized void collect() throws Exception {
    reset();/*from  w w  w .j  a va2s .c o  m*/
    List<QueueInfo> queues;
    YarnClient yarnClient = createYARNClient();
    try {
        queues = yarnClient.getAllQueues();
    } finally {
        yarnClient.stop();
    }
    for (QueueInfo queue : queues) {
        switch (queue.getQueueState()) {
        case RUNNING:
            running++;
            break;
        case STOPPED:
            stopped++;
            break;
        }
    }
}