You could also go with the sharded counter strategy.  The more shards
you have, the less the chance that you'll have a collision, and you'd
use @Version for optimistic locking on each shard.

On Mar 9, 7:18 am, legendlink <gregc...@gmail.com> wrote:
> Thanks for the reply.
>
> If memcache is used, how do I implement it so that the counter would
> always be updated and not be deleted?
>
> On Mar 6, 4:35 am, "Ikai L (Google)" <ika...@google.com> wrote:
>
> > Have you looked into Memcache's INCR?
>
> >http://code.google.com/appengine/docs/java/javadoc/com/google/appengi...,
> > long)
>
> > This'll do it atomically, but you run the risk of it being volatile,
> > so you'll have to account for that in your client code.
>
> > On Tue, Mar 2, 2010 at 11:40 PM, legendlink <gregc...@gmail.com> wrote:
> > > hi, i wanted to have a sequence generator that increments by x value
> > > everytime it generates a value. if i would create the sequence
> > > generator by using the datastore, it is likely that data contention
> > > would occurr if there is high access times.
>
> > > i have looked into the sample code of max ross in the google code
> > > repository (SequenceExamplesJDO.java) and  think this is limited to
> > > increment by 1 only and not increment by x value.
>
> > > if sharding technique is used, my concern is that i might not get the
> > > right sequence.
>
> > > what is the best/elegant way of doing sequence generator that
> > > increments x value?
>
> > > --
> > > You received this message because you are subscribed to the Google Groups 
> > > "Google App Engine for Java" group.
> > > To post to this group, send email to 
> > > google-appengine-j...@googlegroups.com.
> > > To unsubscribe from this group, send email to 
> > > google-appengine-java+unsubscr...@googlegroups.com.
> > > For more options, visit this group 
> > > athttp://groups.google.com/group/google-appengine-java?hl=en.
>
> > --
> > Ikai Lan
> > Developer Programs Engineer, Google App 
> > Enginehttp://googleappengine.blogspot.com|http://twitter.com/app_engine

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to