Bug 247174 - [POLISH] Remove uniqueResourceContents
Summary: [POLISH] Remove uniqueResourceContents
Status: CLOSED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: M3   Edit
Assignee: Simon Mc Duff CLA
QA Contact:
URL:
Whiteboard: Lighter, Faster and Better
Keywords: polish
Depends on:
Blocks:
 
Reported: 2008-09-12 11:17 EDT by Simon Mc Duff CLA
Modified: 2010-06-29 09:22 EDT (History)
1 user (show)

See Also:
stepper: galileo+


Attachments
Patch v1 - uniqueContent deprecated (6.68 KB, patch)
2008-09-14 18:21 EDT, Simon Mc Duff CLA
no flags Details | Diff
Patch v2 (4.35 KB, patch)
2008-09-18 04:06 EDT, Eike Stepper CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Mc Duff CLA 2008-09-12 11:17:16 EDT
This bugs is now fixed.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=246494  

See if we still have performance issue using uniqueResourceContents to false.
If not.. remove it.

Simon
Comment 1 Eike Stepper CLA 2008-09-12 11:33:54 EDT
If we are not otherwise incompatible with EMF 2.4 I'd suggest to keep this API for a while. I assume that it does not harm anything else...
Comment 2 Simon Mc Duff CLA 2008-09-13 21:43:58 EDT
The bugs that Ed is fixing right now will do the job only for containments :-(. I'm asking him to put it for Resource.getContent as well.

Since we already have our own list I put the following:

    /**
     * @since 2.0
     */
    @Override
    public boolean contains(Object object)
    {
      if (object instanceof InternalEObject)
      {
        InternalEObject eObject = (InternalEObject)object;
        return eObject.eDirectResource() == CDOResourceImpl.this;
      }
      return super.contains(object);
    }
    
    and it is working as fast as uniqueCOntent == false.
    
    Can we remove that options ?
Comment 3 Eike Stepper CLA 2008-09-14 02:47:04 EDT
(In reply to comment #2)
> The bugs that Ed is fixing right now will do the job only for containments :-(.
> I'm asking him to put it for Resource.getContent as well.

Good idea.

 
> Since we already have our own list I put the following:
> 
>     /**
>      * @since 2.0
>      */
>     @Override
>     public boolean contains(Object object)
>     {
>       if (object instanceof InternalEObject)
>       {
>         InternalEObject eObject = (InternalEObject)object;
>         return eObject.eDirectResource() == CDOResourceImpl.this;
>       }
>       return super.contains(object);
>     }
> 
>     and it is working as fast as uniqueCOntent == false.

Do you really mean that with this fix all EList methods of Resource.getContents() are always optimized to perform similar to CDOView.setUniqueResourceContents(false)?

> 
>     Can we remove that options ?

Are you asking if we can *now* remove the two methods from CDOView? Again, I'd say no until at least EMF 2.5 is GA. What about a deprecation like:

  /**
   * @see #setUniqueResourceContents(boolean)
   * @deprecated This performance tweak is not necessary with EMF 2.5 anymore and is likely to be removed when CDO
   *             reaches 2.0. In the meantime it can be safely used.
   */
  @Deprecated
  public boolean hasUniqueResourceContents();

  /**
   * Specifies whether the contents list of resources will be unique or not.
   * <p>
   * This property is transient in that it does not stick with resources outside of the scope of this view. Especially
   * it will not be persisted with resources in the repository. Each new view will start with <code>true</code> as a
   * default value. Changing to <code>false</code> will subsequently apply to all resources being loaded or created.
   * <p>
   * <b>Note:</b> The resource contents is a containment list and as such <em>must be</em> unique. Setting this property
   * to <code>false</code> is only recommended for performance optimization when uniqueness is granted by other means.
   * Violating the uniqueness constraint will result in unpredictable behaviour and possible corruption of the
   * repository!
   * 
   * @deprecated This performance tweak is not necessary with EMF 2.5 anymore and is likely to be removed when CDO
   *             reaches 2.0. In the meantime it can be safely used.
   */
  @Deprecated
  public void setUniqueResourceContents(boolean uniqueResourceContents);
Comment 4 Simon Mc Duff CLA 2008-09-14 08:55:51 EDT
Ed also thought it was a good idea!

DOView.setUniqueResourceContents(false) removed the uniqueness.

Our optimization keep it... but use the inverse lookup to determine if the item is in the list.

Yes I asking if we can remove it now. 

We should put it deprecated :-)
Comment 5 Eike Stepper CLA 2008-09-14 11:40:24 EDT
Then I'm fine with it ;-)
Comment 6 Simon Mc Duff CLA 2008-09-14 12:12:06 EDT
I added deprecated and add the feature in ResourceImpl.ContentList into our list.

Should we remove the testcases that use deprecated method ? Or keep it until we remove it completely ?
Comment 7 Eike Stepper CLA 2008-09-14 12:19:40 EDT
(In reply to comment #6)
> Should we remove the testcases that use deprecated method ? Or keep it until we
> remove it completely ?

I'd prefer to mark the test cases with @SuppressWarnings and remove them together with the code under test.
Comment 8 Simon Mc Duff CLA 2008-09-14 18:21:21 EDT
Created attachment 112521 [details]
Patch v1 - uniqueContent deprecated
Comment 9 Eike Stepper CLA 2008-09-18 04:06:18 EDT
Created attachment 112870 [details]
Patch v2

Reviewed, minor changes applied, ready to be committed.
Comment 10 Simon Mc Duff CLA 2008-09-18 11:56:05 EDT
Committed to HEAD
Comment 11 Eike Stepper CLA 2008-09-26 14:38:44 EDT
Fix available in HEAD: 2.0.0.I200809260911.
Comment 12 Eike Stepper CLA 2009-06-27 11:52:52 EDT
Generally available.