brooklyn.entity.nosql.cassandra.CassandraClusterImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of brooklyn-software-nosql Show documentation
Show all versions of brooklyn-software-nosql Show documentation
Brooklyn entities for NoSQL data store software entities
/*
* Copyright 2012-2013 by Cloudsoft Corp.
*/
package brooklyn.entity.nosql.cassandra;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import brooklyn.entity.Entity;
import brooklyn.entity.basic.Attributes;
import brooklyn.entity.group.AbstractMembershipTrackingPolicy;
import brooklyn.entity.group.DynamicClusterImpl;
import brooklyn.entity.proxying.EntitySpec;
import brooklyn.entity.proxying.EntitySpecs;
import brooklyn.entity.trait.Startable;
import brooklyn.event.basic.DependentConfiguration;
import brooklyn.location.Location;
import brooklyn.management.Task;
import brooklyn.util.MutableMap;
import brooklyn.util.task.DeferredSupplier;
import com.google.common.base.Joiner;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
/**
* Implementation of {@link CassandraCluster}.
*/
public class CassandraClusterImpl extends DynamicClusterImpl implements CassandraCluster {
private static final Logger log = LoggerFactory.getLogger(CassandraClusterImpl.class);
// Mutex for synchronizing during re-size operations
private final Object mutex = new Object[0];
private AbstractMembershipTrackingPolicy policy;
public CassandraClusterImpl() {
this(MutableMap.of(), null);
}
public CassandraClusterImpl(Map, ?> properties) {
this(properties, null);
}
public CassandraClusterImpl(Entity parent) {
this(MutableMap.of(), parent);
}
public CassandraClusterImpl(Map, ?> properties, Entity parent) {
super(properties, parent);
}
@Override
public void init() {
super.init();
// This DeferredSupplier will return a comma separated list of all available
// hostnames in the cluster or if none are available yet then a Task for the first
// hostname in the list when it is ready. If there are no nodes yet it returns null.
setConfig(SEEDS, new DeferredSupplier