All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yammer.breakerbox.azure.healthchecks.TableClientHealthcheck Maven / Gradle / Ivy

There is a newer version: 0.6.5
Show newest version
package com.yammer.breakerbox.azure.healthchecks;

import com.codahale.metrics.health.HealthCheck;
import com.google.common.collect.Iterables;
import com.yammer.breakerbox.azure.TableClient;

import static com.google.common.base.Preconditions.checkNotNull;

public class TableClientHealthcheck extends HealthCheck {
    private final TableClient tableClient;

    public TableClientHealthcheck(TableClient tableClient) {
        this.tableClient = checkNotNull(tableClient, "tableClient cannot be null");
    }

    @Override
    public Result check() throws Exception {
        if (Iterables.isEmpty(tableClient.listTables())) {
            return Result.unhealthy("Could not list tables");
        } else {
            return Result.healthy();
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy