You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Ned Wolpert <ne...@imemories.com> on 2010/10/20 18:13:18 UTC

Hector question under cassandra 0.7

Folks-

  I'm finally upgrading the grails-cassandra plugin for 0.7, and wanted to
understand a bit more on the usage of the Cluster and KeyspaceOperator . Is
the cluster object retrieved from HFactor.createCluster() thread safe, and
is the KeyspaceOperator required to only be in one thread? Or are both
thread safe objects? My assumption is I can call createCluster any time as
it will only create one cluster object. I'm trying to decide if the
KeyspaceOperator should be unique to each thread (threadlocal variable) or
unique to each web request.

  Thanks

-- 
Virtually, Ned Wolpert

"Settle thy studies, Faustus, and begin..."   --Marlowe

Re: Hector question under cassandra 0.7

Posted by Ran Tavory <ra...@gmail.com>.
user@cass to bcc

Indeed, the KeyspaceOperator isn't thread safe. (and in recent revisions it
was extracted to an interface at
http://github.com/rantav/hector/blob/master/src/main/java/me/prettyprint/hector/api/Keyspace.javaand
implementation at
http://github.com/rantav/hector/blob/master/src/main/java/me/prettyprint/cassandra/model/ExecutingKeyspace.java

On Thu, Oct 21, 2010 at 12:10 AM, Ned Wolpert <ne...@imemories.com>wrote:

> I figure I'd reply to my own question in case this helps others.
>
> Talking on the IRC, having one KeyspaceOperator per thread (via
> ThreadLocal) makes sense.
>
>
> On Wed, Oct 20, 2010 at 9:13 AM, Ned Wolpert <ne...@imemories.com>wrote:
>
>> Folks-
>>
>>   I'm finally upgrading the grails-cassandra plugin for 0.7, and wanted to
>> understand a bit more on the usage of the Cluster and KeyspaceOperator . Is
>> the cluster object retrieved from HFactor.createCluster() thread safe, and
>> is the KeyspaceOperator required to only be in one thread? Or are both
>> thread safe objects? My assumption is I can call createCluster any time as
>> it will only create one cluster object. I'm trying to decide if the
>> KeyspaceOperator should be unique to each thread (threadlocal variable) or
>> unique to each web request.
>>
>>   Thanks
>>
>> --
>> Virtually, Ned Wolpert
>>
>> "Settle thy studies, Faustus, and begin..."   --Marlowe
>>
>
>
>
> --
> Virtually, Ned Wolpert
>
> "Settle thy studies, Faustus, and begin..."   --Marlowe
>



-- 
/Ran

Re: Hector question under cassandra 0.7

Posted by Ned Wolpert <ne...@imemories.com>.
I figure I'd reply to my own question in case this helps others.

Talking on the IRC, having one KeyspaceOperator per thread (via ThreadLocal)
makes sense.

On Wed, Oct 20, 2010 at 9:13 AM, Ned Wolpert <ne...@imemories.com>wrote:

> Folks-
>
>   I'm finally upgrading the grails-cassandra plugin for 0.7, and wanted to
> understand a bit more on the usage of the Cluster and KeyspaceOperator . Is
> the cluster object retrieved from HFactor.createCluster() thread safe, and
> is the KeyspaceOperator required to only be in one thread? Or are both
> thread safe objects? My assumption is I can call createCluster any time as
> it will only create one cluster object. I'm trying to decide if the
> KeyspaceOperator should be unique to each thread (threadlocal variable) or
> unique to each web request.
>
>   Thanks
>
> --
> Virtually, Ned Wolpert
>
> "Settle thy studies, Faustus, and begin..."   --Marlowe
>



-- 
Virtually, Ned Wolpert

"Settle thy studies, Faustus, and begin..."   --Marlowe