/**
 * Copyright 2016 Smoke Turner, LLC.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.smoketurner.notification.application.health;

import java.util.List;
import java.util.Objects;
import javax.annotation.Nonnull;
import com.basho.riak.client.api.RiakClient;
import com.basho.riak.client.core.RiakNode;
import com.codahale.metrics.health.HealthCheck;

public class RiakHealthCheck extends HealthCheck {

    private final RiakClient client;

    /**
     * Constructor
     *
     * @param client
     *            Riak client
     */
    public RiakHealthCheck(@Nonnull final RiakClient client) {
        this.client = Objects.requireNonNull(client);
    }

    @Override
    protected Result check() throws Exception {
        final List<RiakNode> nodes = client.getRiakCluster().getNodes();
        if (!nodes.isEmpty()) {
            return Result.healthy();
        }
        return Result.unhealthy("No available Riak nodes");
    }
}

@@ -654,31 +654,8 @@
 h;%0A%0A
-import java.util.List;%0A
 impo
@@ -788,24 +788,40 @@
 nt.core.
-RiakNode
+operations.PingOperation
 ;%0Aimport
@@ -1250,93 +1250,146 @@
 nal 
-List%3CRiakNode%3E nodes = client.getRiakCluster().getNodes();%0A        if (!nodes.isEmpty
+PingOperation ping = new PingOperation();%0A        client.getRiakCluster().execute(ping);%0A        ping.await();%0A%0A        if (ping.isSuccess
 ()) 
@@ -1424,16 +1424,34 @@
 healthy(
+%22Riak is healthly%22
 );%0A     
@@ -1492,31 +1492,20 @@
 hy(%22
-No available Riak nodes
+Riak is down
 %22);%0A

Add a proper Riak health check