incubator-cassandra-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Dusbabek <>
Subject Re: Creating two instances in code
Date Fri, 30 Jul 2010 19:12:15 GMT
Several more.  Without much thinking there are Gossiper,
MessageService and StorageService.  All are singletons that
encapsulate much of the functionality of Cassandra.  We've been very
consistent about naming the singleton instances "instance," so if you
search for "public static final [\w]+ instance" and ignore what you
find in db.marshal, you'll have a pretty good idea of what you're in


On Fri, Jul 30, 2010 at 12:01,  <> wrote:
> Thank you for your answer. I know I should change the code. My question
> was mainly on how to change the code to do this.
> For example, will making DatabaseDescriptor a non-static class be enough?
> I could have Cassandra build a DatabaseDescriptor instance at startup,
> which could be a class variable of some basic class, and then replace all
> instances of DatabaseDescriptor.someFunction() with method calls on the
> object. Will that be enough or are there many more singletons in the code?
> Any different suggestions?
> Alexander Altanis
>> The resource file (cassandra.yaml) is statically defined that is
>> brought in from the classpath. To do what you desire will require
>> changing the code.
>> You could modify DatabaseDescriptor.getStorageConfigPath() to accept
>> some kind of variable to indicate the instance and then load a
>> different file.
>> But that's the least of your problems, as you're probably noticing.
>> The heavy use of singletons will prevent you from isolating some of
>> the services, and the fact that DatabaseDescriptor loads its
>> configuration in a static block into static members will be very
>> problematic.
>> Gary.
>> On Thu, Jul 29, 2010 at 11:36,  <> wrote:
>> > Hello,
>> >
>> > I'd like to make some changes to cassandra so that when starting up a
> node
>> > in a cluster, another node starts in another cluster. That requires that
>> > the two nodes have different configurations, but DatabaseDescriptor
> (where
>> > I think all the config reading is done) seems to load everything
>> > statically when the class is loaded. The configuration path seems to
>> > reside in System.getProperties(). Can you suggest a way for me to build a
>> > second node with a different configuration path in the same code?
>> >
>> > Unfortunately, I cannot simply launch two different cassandra
> instances on
>> > the same computer, as I want the second node to have access to
> information
>> > from the first node, such as node load for the first cluster and such
>> > (plus even running two separate cassandra instances on the same node
> seems
>> > to require workarounds and hacks).
>> >
>> > Alexander Altanis
>> >

View raw message