[appengine-java] Implementation question regarding efficient check and lock on datastore
Hi, I got a rather simple question and I am sure there is a simple solution. Let's say I got a RPC endpoint that checks if an entity exists and then creates another entity. This RPC endpoint can be called simultaneously on different instances. Say we got a user object, and sometimes we generate an AccountStatus for the User. The generation is triggered by an RPC call that checks if AccountStatus for an User exists - if not it generates a new entity. The problem is: While one RPC checks if an entity exists - the other RPC call is already after the check (with no result) and generates the AccountStatus entity. This results in two entities being created and not one. I guess what I want to have is some kind of check and lock. My question is how to implement an "efficient" lock on a distributed environment like GAE. Transactions? Or better using memcache? Is there a best practise how to implement that? Thanks :) Best, Raphael -- 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-java@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] Implementation question regarding efficient check and lock on datastore
> I guess what I want to have is some kind of check and lock. My > question is how to implement an "efficient" lock on a distributed > environment like GAE. Transactions? Or better using memcache? > > > Is there a best practise how to implement that? I'm not saying this is best practice but just throwing it out there... 1 start transaction 2a run check on entity on whether AccountStatus needs generation 2b (if AccountStatus needs generation && AccountStatusLock entity is null ) store entity Key or unique identifier in separate AccountStatusLock entity 2c commit transaction [which stores AccountStatusLock] 3a generate AccountStatus 3b commit entity with generated AccountStatus 4 delete AccountStatusLock Shawn -- 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-java@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] proxying datastore request
This seems like something you might do in a servlet filter. Have you considered user specific namespaces if you completely want user data in silos? You can set the namespace in the servlet filter: http://code.google.com/appengine/docs/java/multitenancy/multitenancy.html -- Ikai Lan Developer Programs Engineer, Google App Engine plus.ikailan.com | twitter.com/ikai On Wed, Jan 11, 2012 at 12:31 PM, meiaestro wrote: > Thanks for the reply. > > ** ** > > You're right. I did not use the Users API, as I do not want to force the > users to have a google account (or any other existing account). This will > be optional at a later point in time. > > ** ** > > The user authentication happens on server side by a self-programmed > algorithm. Username and the hash values of the user's password are stored > in the datastore. So far this authentication is independent from any > session ID. > > > Hope this helps a bit. > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine for Java" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/google-appengine-java/-/_MQ2fHNOUqsJ. > > To post to this group, send email to > google-appengine-java@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. > -- 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-java@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.
[appengine-java] SocketTimeoutException when using URLFetch and Channel.sendMessage
We have an AppEngine app (App 1) that makes an API call via URLFetch to another AppEngine app (App 2). In App 2, we use the channel API to send a message to any open channels about the data we've just saved. All of the code in App 2 executes fine and the message does get received on the channel. But we get a SocketTimeoutException in App 1 after the request is finished. The exception is received even before the ten second limit is reached. When I comment out the code to send the message down the channel, I don't get the exception. Both apps are marked as thread-safe. Wondering if we've missed a configuration somewhere? -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine-java/-/kzMD3_MoOAEJ. To post to this group, send email to google-appengine-java@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.
[appengine-java] embedding dev_appserver
Hi, I'm trying to start a dev_appserver instance inside a running jvm. So I'm doing: DevAppServerFactory.createDevAppServer(new File("war").getCanonicalFile(), "0.0.0.0", 8080) This throws an access permission exception: access denied (java.io.FilePermission /tmp/test2180295141950803071.policy delete) [Thrown class java.security.AccessControlException] Does anybody know what I'm doing wrong? Or how I can I embed the dev_appserver in a running JVM. Thanks, Razvan -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine-java/-/A6nzmTt7zbcJ. To post to this group, send email to google-appengine-java@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.
[appengine-java] Oracle JDBC connection in App Engine
Hi, I am new to App Engine. I imported an existing project in eclipse 3.6 with GWT and App Engine. The issue I am facing is while connecting to oracle database. Our existing project is tightly coupled with oracle. Can any one guide me on how to establish jdbc connection with oracle to run it in App Engine? Thanks, Neelima -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine-java/-/MVG0cKbtxRgJ. To post to this group, send email to google-appengine-java@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.
[appengine-java] Re: Oracle JDBC connection in App Engine
Hi, I'm afraid there is no way to connect to external databases. Currently the only access you can have is either to the GAE big table-based datastore via various APIs (JPA, JDO, low level API, or third party such as Objectify/Twig/Slim3), or to external applications via an HTTP interface. There is a product in beta for SQL access to a GAE-hosted MySQL instance, but once again this won't allow access to externally hosted databases. Cheers, Simon -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine-java/-/8mflsu3SOogJ. To post to this group, send email to google-appengine-java@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.
[appengine-java] Re: SocketTimeoutException when using URLFetch and Channel.sendMessage
Since posting this, I've got something that's working. In App 2, instead of notifying open channels directly of the new data, I'm queuing up a task which does the same thing. I would rather not have to do this though so if someone has some insight as to why URLFetch to a service that sends a channel message fails for us, I'm all ears. -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine-java/-/SGCKcRmX15QJ. To post to this group, send email to google-appengine-java@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.
[appengine-java] Tree structure using JPA and extension
Hi, I successfully implemented a tree data model using JPA and extensions using this type of annotation: @Id @Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = "true") @GeneratedValue(strategy = GenerationType.IDENTITY) private String id; with bi-directional relationships between the parents and children. The leaf of that 6 level tree end up with primary keys that show up as this in the datastore viewer: aglzZW5zb3JpZXRyWwsSBFJvb3QYswsMCxIHTmV0d29yaxi0CwwLEgpTdWJOZXR3b3JrGLULDAsSB0lPQm9hcmQYuAsMCxIISU9TYW1wbGUY2QsMCxINSU9TYW1wbGVWYWx1ZRjaCww Considering that there will be a lot of such leaves, and that these leaves will each have very little data, does that mean that my datastore daily bill will be significantly affected by this type of structure? Would making leaves top level entities with a single relationship with their parent make a big difference ? (i.e. use a LONG primary key instead of the extension gae.encoded-pk) Or would the direct usage of the app engine datastore Key type make another big difference in datastore space usage ? thanks, -- Claude -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine-java/-/Vdnkx9anxHQJ. To post to this group, send email to google-appengine-java@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.