Duplicate UUID's corrupting the diagrams [message #533646] |
Fri, 14 May 2010 17:52  |
Eclipse User |
|
|
|
Not sure if this or EMF is the correct newsgroup so I will start here...
When we create our diagrams (programatically create elements on the
diagram), or copy and paste and a large # of elements on our diagram,
our diagrams will eventually get a duplicate UUID(s) and become corrupt
(randomly).
It appears that the generateUUID method is returning the same value one
multiple calls?
In my *Resource class in attachedHelper, is there anything I can do to
verify the id has not already been used and generate a new one if it
has? Seems like there could be alot of overhead checking all previous
uuids when generating new ones... Ive gone as far as trying to append
the nanotime to the uuid, but then my diagrams wont open i assume from
the uuid not being valid, as when I revery it is fine...
I believe the only reason we use UUID's is for Copy and Paste, is that
still necessary?
any pointers would be helpful
Thanks
|
|
|
Re: Duplicate UUID's corrupting the diagrams [message #533693 is a reply to message #533646] |
Sat, 15 May 2010 12:47   |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
--------------030602080602000000030303
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Brian,
Comments below.
Brian Jakubik wrote:
> Not sure if this or EMF is the correct newsgroup so I will start here...
>
> When we create our diagrams (programatically create elements on the
> diagram), or copy and paste and a large # of elements on our diagram,
> our diagrams will eventually get a duplicate UUID(s) and become
> corrupt (randomly).
I'm not sure how that's possible given the ID is set like this in
XMLResourceImpl:
public void setID(EObject eObject, String id)
{
Object oldID = id != null ? getEObjectToIDMap().put(eObject, id)
: getEObjectToIDMap().remove(eObject);
if (oldID != null)
{
getIDToEObjectMap().remove(oldID);
}
if (id != null)
{
getIDToEObjectMap().put(id, eObject);
}
}
> It appears that the generateUUID method is returning the same value
> one multiple calls?
I think that's impossible. The system clock is encoded as part of the
value.
>
> In my *Resource class in attachedHelper, is there anything I can do to
> verify the id has not already been used and generate a new one if it
> has? Seems like there could be alot of overhead checking all previous
> uuids when generating new ones... Ive gone as far as trying to append
> the nanotime to the uuid, but then my diagrams wont open i assume from
> the uuid not being valid, as when I revery it is fine...
The UUID generator will actually sleep to avoid generating too many
UUIDs within a given clock tick.
>
> I believe the only reason we use UUID's is for Copy and Paste, is that
> still necessary?
>
> any pointers would be helpful
> Thanks
--------------030602080602000000030303
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Brian,<br>
<br>
Comments below.<br>
<br>
Brian Jakubik wrote:
<blockquote cite="mid:hskgmi$13v$1@build.eclipse.org" type="cite">Not
sure if this or EMF is the correct newsgroup so I will start here...
<br>
<br>
When we create our diagrams (programatically create elements on the
diagram), or copy and paste and a large # of elements on our diagram,
our diagrams will eventually get a duplicate UUID(s) and become corrupt
(randomly).
<br>
</blockquote>
I'm not sure how that's possible given the ID is set like this in
XMLResourceImpl:<br>
<blockquote><small> public void setID(EObject eObject, String id)</small><br>
<small> {</small><br>
<small> Object oldID = id != null ?
getEObjectToIDMap().put(eObject, id) :
getEObjectToIDMap().remove(eObject);</small><br>
<small> </small><br>
<small> if (oldID != null)</small><br>
<small> {</small><br>
<small> getIDToEObjectMap().remove(oldID);</small><br>
<small> }</small><br>
<small> </small><br>
<small> if (id != null)</small><br>
<small> {</small><br>
<small> getIDToEObjectMap().put(id, eObject);</small><br>
<small> }</small><br>
<small> }</small><br>
</blockquote>
<br>
<blockquote cite="mid:hskgmi$13v$1@build.eclipse.org" type="cite">It
appears that the generateUUID method is returning the same value one
multiple calls?
<br>
</blockquote>
I think that's impossible. The system clock is encoded as part of the
value.<br>
<blockquote cite="mid:hskgmi$13v$1@build.eclipse.org" type="cite"><br>
In my *Resource class in attachedHelper, is there anything I can do to
verify the id has not already been used and generate a new one if it
has? Seems like there could be alot of overhead checking all previous
uuids when generating new ones... Ive gone as far as trying to append
the nanotime to the uuid, but then my diagrams wont open i assume from
the uuid not being valid, as when I revery it is fine...
<br>
</blockquote>
The UUID generator will actually sleep to avoid generating too many
UUIDs within a given clock tick.<br>
<blockquote cite="mid:hskgmi$13v$1@build.eclipse.org" type="cite"><br>
I believe the only reason we use UUID's is for Copy and Paste, is that
still necessary?
<br>
<br>
any pointers would be helpful
<br>
Thanks
<br>
</blockquote>
</body>
</html>
--------------030602080602000000030303--
|
|
|
Re: Duplicate UUID's corrupting the diagrams [message #533841 is a reply to message #533693] |
Mon, 17 May 2010 05:21  |
Eclipse User |
|
|
|
Ed Merks a écrit :
> Brian,
>
> Comments below.
>
> Brian Jakubik wrote:
>> Not sure if this or EMF is the correct newsgroup so I will start here...
>>
>> When we create our diagrams (programatically create elements on the
>> diagram), or copy and paste and a large # of elements on our diagram,
>> our diagrams will eventually get a duplicate UUID(s) and become
>> corrupt (randomly).
> I'm not sure how that's possible given the ID is set like this in
> XMLResourceImpl:
>
> public void setID(EObject eObject, String id)
> {
> Object oldID = id != null ? getEObjectToIDMap().put(eObject, id)
> : getEObjectToIDMap().remove(eObject);
>
> if (oldID != null)
> {
> getIDToEObjectMap().remove(oldID);
> }
>
> if (id != null)
> {
> getIDToEObjectMap().put(id, eObject);
> }
> }
>
>
>> It appears that the generateUUID method is returning the same value
>> one multiple calls?
> I think that's impossible. The system clock is encoded as part of the
> value.
>>
>> In my *Resource class in attachedHelper, is there anything I can do to
>> verify the id has not already been used and generate a new one if it
>> has? Seems like there could be alot of overhead checking all previous
>> uuids when generating new ones... Ive gone as far as trying to append
>> the nanotime to the uuid, but then my diagrams wont open i assume from
>> the uuid not being valid, as when I revery it is fine...
> The UUID generator will actually sleep to avoid generating too many
> UUIDs within a given clock tick.
>>
>> I believe the only reason we use UUID's is for Copy and Paste, is that
>> still necessary?
yep using UUID's is still necessary for Copy/Paste in GMF.
>>
>> any pointers would be helpful
>> Thanks
|
|
|
Powered by
FUDForum. Page generated in 0.03665 seconds