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

com.bazaarvoice.emodb.event.db.astyanax.VerifyRandomPartitioner Maven / Gradle / Ivy

There is a newer version: 6.5.190
Show newest version
package com.bazaarvoice.emodb.event.db.astyanax;

import com.bazaarvoice.emodb.common.cassandra.CassandraKeyspace;
import com.bazaarvoice.emodb.common.dropwizard.lifecycle.LifeCycleRegistry;
import com.google.inject.Inject;
import io.dropwizard.lifecycle.Managed;
import org.apache.cassandra.dht.RandomPartitioner;

import java.io.IOException;

public class VerifyRandomPartitioner implements Managed {
    private final CassandraKeyspace _keyspace;

    @Inject
    public VerifyRandomPartitioner(LifeCycleRegistry lifeCycle, CassandraKeyspace keyspace) {
        _keyspace = keyspace;
        lifeCycle.manage(this);
    }

    @Override
    public void start() throws Exception {
        // Not using the RandomPartitioner could lead to hotspots in the Cassandra ring.
        _keyspace.warnIfPartitionerMismatch(RandomPartitioner.class);
    }

    @Override
    public void stop() throws IOException {
        // Do nothing
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy