rantav/hector — pull request #383 by abramsm (2012-01-09 12:31:52+00:00)
Title: prevent NPE when auto discovering hosts on cluster init

auto discovering hosts caused a NPE because the cluster wasn't
already in the clusters Map. The issue is discussed here: http://comments.gmane.org/gmane.comp.db.hector.user/5292

at
me.prettyprint.cassandra.connection.NodeAutoDiscoverService.discoverNodes(NodeAutoDiscoverService.java:
97)	at
me.prettyprint.cassandra.connection.NodeAutoDiscoverService.doAddNodes(NodeAutoDiscoverService.java:
68)	at
me.prettyprint.cassandra.connection.HConnectionManager.(HConnectionManager.java:
94)	at
me.prettyprint.cassandra.service.AbstractCluster.(AbstractCluster.java:
67)	at
me.prettyprint.cassandra.service.ThriftCluster.(ThriftCluster.java:
21)	at
me.prettyprint.hector.api.factory.HFactory.createCluster(HFactory.java:
192)	at
me.prettyprint.hector.api.factory.HFactory.createCluster(HFactory.java:
172)	at
me.prettyprint.cassandra.jndi.CassandraClientJndiResourceFactory.configure(CassandraClientJndiResourceFactory.java:
127)	at
me.prettyprint.cassandra.jndi.CassandraClientJndiResourceFactory.getObjectInstance(CassandraClientJndiResourceFactory.java:
83)	at
org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:
140)	at
javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:
304)	at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
at org.apache.naming.NamingContext.lookup(NamingContext.java:140)	at
org.apache.naming.NamingContext.lookup(NamingContext.java:781)	at

This patch adds a 'onStartup' method to a cluster
to run init steps that will be performed after the cluster
is in that map