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

com.netflix.astyanax.util.SingletonEmbeddedCassandra Maven / Gradle / Ivy

There is a newer version: 3.10.2
Show newest version
package com.netflix.astyanax.util;

import com.netflix.astyanax.test.EmbeddedCassandra;

public class SingletonEmbeddedCassandra {
    
    private static class Holder {
        private static final SingletonEmbeddedCassandra instance = new SingletonEmbeddedCassandra();
    }

    private final EmbeddedCassandra         cassandra;

    private SingletonEmbeddedCassandra() {
        try {
            cassandra = new EmbeddedCassandra();
            cassandra.start();
        } catch (Exception e) {
            throw new RuntimeException("Failed to start embedded cassandra", e);
        }
    }
    
    public static SingletonEmbeddedCassandra getInstance() {
        return Holder.instance;
    }
    
    public void shutdown() {
        try {
            cassandra.stop();
        }
        catch (Exception e) {
            
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy