|
|
|
Re: EMF / GWT Datastore Contention Issues / Failed to Save [message #778945 is a reply to message #778815] |
Sat, 14 January 2012 07:22 |
Ed Merks Messages: 33218 Registered: July 2009 |
Senior Member |
|
|
Pasquale,
Comments below.
On 13/01/2012 11:11 PM, Pasquale Gervasi wrote:
> Hi Ed, sorry for the silence I was dealing with another issue on GAE.
> Ok, back to your reply, would your generated editor have the same
> issue if there were enough users clicking the save button at the same
> time?
I suppose it's possible too. One user couldn't generate the volume
because they're waiting for the result of one save, but if many users
were saving the same thing at once, which of course one would expect to
lead to many failures because all but one would be trying to overwrite
some else's change, then it could be possible too. Of course such a
design would be frustrating to most users, so that's not really workable
anyway.
> Or is there something in the async process that would prevent this issue.
No, I doubt it
> Just wondering if you would recommend I trace the generated client
> side code all the way to the server side and see how I could use it.
I suspect it's an issue reproducible purely on the server side, but I
don't know...
> Other options, which seems ugly, is having to implement task queues on
> the save operation. Any other suggestions?
Given that colliding saves should fail anyway, you might do a time stamp
check before saving. Or am I not understanding something about your
application? I.e., should there be no failures at all because all your
saves are properly serialized?
>
> Pasquale
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
|
|
|
|
Re: EMF / GWT Datastore Contention Issues / Failed to Save [message #780973 is a reply to message #780437] |
Wed, 18 January 2012 08:08 |
Ed Merks Messages: 33218 Registered: July 2009 |
Senior Member |
|
|
Pasquale,
Comments below.
On 17/01/2012 10:38 PM, Pasquale Gervasi wrote:
> Hi Ed,
>
> Each user is only adding a new session entity to the datastore - never
> changing existing entities. I never need to access the other entities
> but the only way I know to save the new entity correctly is:
>
> resource =
> resourceSet.getResource(URI.createURI("datastore:/SessionLog"),true);
You show a fixed URI that everyone shares because it's the same for
everyone. It doesn't make sense to load one if you expect this to be
new information.
>
> then adding a new entity to it:
>
> resource.getContents().add(commSession);
>
> and then save. Is there a way to save the new entity without loading
> the resource?
Use a different URI for each client and each session. Have a look at
DatastoreUtil.OPTION_SESSION to see how that approach stores everything
under session-specific keys.
> I tried createResource without loading but when I save I lose previous
> saved entities and I tried
> resource =
> resourceSet.getResource(URI.createURI("datastore:/SessionLog"),true);
>
> resource.unload();
>
> and got the same result as createResource.
Keep in mind what OPTION_UPDATE_ONLY_IF_TIME_STAMP_MATCHES. Your save
will fail if the time stamp in the data store doesn't match the given
time stamp. But of course for a resource that's new , it's not in the
repo and using this option will fail every time. Don't use that
option unless your saving changes you made to a resource you loaded and
which you want to overwrite the previous version you loaded.
>
> When you say, "I think each user's session should be saved under a
> different entity and then you can query all those entities to produce
> an aggregate."
>
> How would you construct the URI and prepare the resource before
> executing the resource.getContents().add command on the entity?
For a new resource, the URI matters only when you save it.
> Append obj.Hashcode() to the URI?
How will you want to identify sessions later when you make use of them?
If you included the user identity and perhaps a creation timestamp as
part of the URI (the time the session you're recording started perhaps),
you'd end up with something unique. Using EcoreUtil.generateUUID is
another approach.
> I'm not understanding sorry. I'm a junior member after all.
>
> Pasquale
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Powered by
FUDForum. Page generated in 0.03980 seconds