Re: [appengine-java] Re: Eventually consistent reads and JDO

2010-04-02 Thread Matt Farnell
I finally figured it out, its on the Datastore config level.

DatastoreServiceConfig config =
DatastoreServiceConfig.Builder.withReadPolicy(new ReadPolicy(Consistency.
EVENTUAL));

DatastoreService dss = DatastoreServiceFactory.getDatastoreService(config);

I thought it would have been on the Query object as it is in the JDO example
posted in the blog. I was using a singleton as I thought we were only meant
to instantiate one DatastoreService instance and reuse it??


On Fri, Apr 2, 2010 at 1:04 AM, lepah mfarn...@gmail.com wrote:

 Hi there,

 How can I use this with the low level datastore, I've looked around in
 the JavaDocs and found ReadPolicy.Consistency but couldn't find
 anywhere to set it. It could be just me as it's 1AM. Would love to try
 it out.

 On Apr 1, 11:39 am, Isdal tomas.is...@gmail.com wrote:
  Thanks Ikai!
 
  I noticed that the docs are updated now too. This page has a couple
  examples on it as well:
 http://code.google.com/appengine/docs/java/datastore/usingjdo.html
 
  // Tomas
 
  On Mar 30, 3:57 pm, Ikai L (Google) ika...@google.com wrote:
 
 
 
   Yep. The example is documented here:
 
  http://googleappengine.blogspot.com/2010/03/read-consistency-deadline.
 ..
 
   
 http://googleappengine.blogspot.com/2010/03/read-consistency-deadline..
 .Query
   q = pm.newQuery(Employee.class);
   q.addExtension(datanucleus.appengine.datastoreReadConsistency,
   EVENTUAL);
 
   On Fri, Mar 26, 2010 at 5:12 PM, Isdal tomas.is...@gmail.com wrote:
Hi all,
 
Thanks for all new new features in 1.3.2!
 
I was just wondering if it is possible to use the
ReadPolicy.Consistency.EVENTUAL feature and still use the JDO
interface.
 
I am currently getting a PersistenceManager with:
JDOHelper.getPersistenceManagerFactory(transactions-
optional);
 
Is there a way to tell the PersistenceManager to tell the datastore
 to
accept eventually consistent reads? Most of my app can handle stale
data, and any performance improvement would be great!
 
Thanks!
 
// Tomas
 
--
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.comgoogle-appengine-java%2bunsubscr...@googlegroups.comgoogle-appengine-java%2B
 unsubscr...@googlegroups.com
.
For more options, visit this group at
   http://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.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/google-appengine-java?hl=en.



-- 
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.



Re: [appengine-java] Re: Eventually consistent reads and JDO

2010-04-02 Thread Ikai L (Google)
You're probably best off creating new instances of DatastoreService. There
are some good points raised here:

https://groups.google.com/group/google-appengine-java/browse_thread/thread/e19b792042b2ff9b#

On Fri, Apr 2, 2010 at 1:26 AM, Matt Farnell mfarn...@gmail.com wrote:

 I finally figured it out, its on the Datastore config level.

 DatastoreServiceConfig config =
 DatastoreServiceConfig.Builder.withReadPolicy(new ReadPolicy(Consistency.
 EVENTUAL));

 DatastoreService dss = DatastoreServiceFactory.getDatastoreService(config);

 I thought it would have been on the Query object as it is in the JDO
 example posted in the blog. I was using a singleton as I thought we were
 only meant to instantiate one DatastoreService instance and reuse it??


 On Fri, Apr 2, 2010 at 1:04 AM, lepah mfarn...@gmail.com wrote:

 Hi there,

 How can I use this with the low level datastore, I've looked around in
 the JavaDocs and found ReadPolicy.Consistency but couldn't find
 anywhere to set it. It could be just me as it's 1AM. Would love to try
 it out.

 On Apr 1, 11:39 am, Isdal tomas.is...@gmail.com wrote:
  Thanks Ikai!
 
  I noticed that the docs are updated now too. This page has a couple
  examples on it as well:
 http://code.google.com/appengine/docs/java/datastore/usingjdo.html
 
  // Tomas
 
  On Mar 30, 3:57 pm, Ikai L (Google) ika...@google.com wrote:
 
 
 
   Yep. The example is documented here:
 
  http://googleappengine.blogspot.com/2010/03/read-consistency-deadline.
 ..
 
   
 http://googleappengine.blogspot.com/2010/03/read-consistency-deadline..
 .Query
   q = pm.newQuery(Employee.class);
   q.addExtension(datanucleus.appengine.datastoreReadConsistency,
   EVENTUAL);
 
   On Fri, Mar 26, 2010 at 5:12 PM, Isdal tomas.is...@gmail.com wrote:
Hi all,
 
Thanks for all new new features in 1.3.2!
 
I was just wondering if it is possible to use the
ReadPolicy.Consistency.EVENTUAL feature and still use the JDO
interface.
 
I am currently getting a PersistenceManager with:
JDOHelper.getPersistenceManagerFactory(transactions-
optional);
 
Is there a way to tell the PersistenceManager to tell the datastore
 to
accept eventually consistent reads? Most of my app can handle stale
data, and any performance improvement would be great!
 
Thanks!
 
// Tomas
 
--
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.comgoogle-appengine-java%2bunsubscr...@googlegroups.comgoogle-appengine-java%2B
 unsubscr...@googlegroups.com
.
For more options, visit this group at
   http://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.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/google-appengine-java?hl=en.


  --
 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.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/google-appengine-java?hl=en.




-- 
Ikai Lan
Developer Programs Engineer, Google App Engine
http://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.



Re: [appengine-java] Re: Eventually consistent reads and JDO

2010-04-02 Thread Ikai L (Google)
Since it is not explicitly documented as thread safe, you should not make
this assumption. Basically, it's the same as us telling you not to use
undocumented methods because they *can* and *have* changed.

On Fri, Apr 2, 2010 at 11:46 AM, Matt Farnell mfarn...@gmail.com wrote:

 Hi Ikai,

 It says in that forum that it's 'probably' not thread safe, so is it thread
 safe or not? If its not threadsafe then we should never use a singleton
 instance.

 Can you give us a more definitive answer such as it's not threadsafe so
 never cache the instance, or it is threadsafe so therefore it is up to us.
 It would be very helpful.

 thanks,
 Matt

 On Fri, Apr 2, 2010 at 9:54 AM, Ikai L (Google) ika...@google.com wrote:

 You're probably best off creating new instances of DatastoreService. There
 are some good points raised here:


 https://groups.google.com/group/google-appengine-java/browse_thread/thread/e19b792042b2ff9b#

 On Fri, Apr 2, 2010 at 1:26 AM, Matt Farnell mfarn...@gmail.com wrote:

 I finally figured it out, its on the Datastore config level.

 DatastoreServiceConfig config =
 DatastoreServiceConfig.Builder.withReadPolicy(newReadPolicy(Consistency.
 EVENTUAL));

 DatastoreService dss
 = DatastoreServiceFactory.getDatastoreService(config);

 I thought it would have been on the Query object as it is in the JDO
 example posted in the blog. I was using a singleton as I thought we were
 only meant to instantiate one DatastoreService instance and reuse it??


 On Fri, Apr 2, 2010 at 1:04 AM, lepah mfarn...@gmail.com wrote:

 Hi there,

 How can I use this with the low level datastore, I've looked around in
 the JavaDocs and found ReadPolicy.Consistency but couldn't find
 anywhere to set it. It could be just me as it's 1AM. Would love to try
 it out.

 On Apr 1, 11:39 am, Isdal tomas.is...@gmail.com wrote:
  Thanks Ikai!
 
  I noticed that the docs are updated now too. This page has a couple
  examples on it as well:
 http://code.google.com/appengine/docs/java/datastore/usingjdo.html
 
  // Tomas
 
  On Mar 30, 3:57 pm, Ikai L (Google) ika...@google.com wrote:
 
 
 
   Yep. The example is documented here:
 
  
 http://googleappengine.blogspot.com/2010/03/read-consistency-deadline.
 ..
 
   
 http://googleappengine.blogspot.com/2010/03/read-consistency-deadline..
 .Query
   q = pm.newQuery(Employee.class);
   q.addExtension(datanucleus.appengine.datastoreReadConsistency,
   EVENTUAL);
 
   On Fri, Mar 26, 2010 at 5:12 PM, Isdal tomas.is...@gmail.com
 wrote:
Hi all,
 
Thanks for all new new features in 1.3.2!
 
I was just wondering if it is possible to use the
ReadPolicy.Consistency.EVENTUAL feature and still use the JDO
interface.
 
I am currently getting a PersistenceManager with:
JDOHelper.getPersistenceManagerFactory(transactions-
optional);
 
Is there a way to tell the PersistenceManager to tell the
 datastore to
accept eventually consistent reads? Most of my app can handle
 stale
data, and any performance improvement would be great!
 
Thanks!
 
// Tomas
 
--
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.comgoogle-appengine-java%2bunsubscr...@googlegroups.comgoogle-appengine-java%2B
 unsubscr...@googlegroups.com
.
For more options, visit this group at
   http://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.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/google-appengine-java?hl=en.


  --
 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.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/google-appengine-java?hl=en.




 --
 Ikai Lan
 Developer Programs Engineer, Google App Engine
 http://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