Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Modeling (top-level project) » How to make sure that a resource is written
How to make sure that a resource is written [message #617809] Thu, 03 September 2009 13:00
Roland Brand is currently offline Roland BrandFriend
Messages: 42
Registered: July 2009
Hi all

I'm trying to read an EMF resource. In case it does not exist, I create a
new one, add some default content to it and call save().

Now I've got the problem, that after the save(), the resource might still
not exist and an IOException is thrown when I try to load the resource. It
seems like a race condition to me, since it never occurs in the debugger.
So I helped myself with the following loop:

(!resource.getResourceSet().getURIConverter().exists(resourc e.getURI(),
System.out.println("save it");;

It is now clear, that save() does not guarantee the existence of the
resource after it has been called. I have seen up to 30 executions of the
while-loop until the resource finally existed.

My question is: how can I make sure, that the new resource really exists?
The while-loop does not look like a nice solution to me. Or am I
misunderstanding something?

Thanks for your helpful posts ;-)

Previous Topic:Creating objects with multi-valued children
Next Topic:How to make sure that a resource is written
Goto Forum:

Current Time: Fri Aug 19 04:44:14 GMT 2022

Powered by FUDForum. Page generated in 0.02221 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top