Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 205531 Details for
Bug 361382
Memory leaks in profiling.ext
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch with caching profiles
memory_leak_profiling_3.patch (text/plain), 4.16 KB, created by
Tatiana Fesenko
on 2011-10-19 10:17:38 EDT
(
hide
)
Description:
Patch with caching profiles
Filename:
MIME Type:
Creator:
Tatiana Fesenko
Created:
2011-10-19 10:17:38 EDT
Size:
4.16 KB
patch
obsolete
>From 9cc2937639a46ab369ca79d81a4948da5a6c3b8e Mon Sep 17 00:00:00 2001 >From: tfesenko <tatiana.fesenko@gmail.com> >Date: Wed, 19 Oct 2011 18:15:58 +0400 >Subject: [PATCH] Bug 361380 - profiling.ext: Profile application for Package is not supported > >--- > .../uml2/profile/ProfilingExtensions.java | 33 +++++++++++++++++++- > .../xtend/typesystem/uml2/profile/profiling.ext | 4 ++- > 2 files changed, 35 insertions(+), 2 deletions(-) > >diff --git a/plugins/org.eclipse.xtend.typesystem.uml2/src/org/eclipse/xtend/typesystem/uml2/profile/ProfilingExtensions.java b/plugins/org.eclipse.xtend.typesystem.uml2/src/org/eclipse/xtend/typesystem/uml2/profile/ProfilingExtensions.java >index 2d5d2b8..ad35b58 100644 >--- a/plugins/org.eclipse.xtend.typesystem.uml2/src/org/eclipse/xtend/typesystem/uml2/profile/ProfilingExtensions.java >+++ b/plugins/org.eclipse.xtend.typesystem.uml2/src/org/eclipse/xtend/typesystem/uml2/profile/ProfilingExtensions.java >@@ -12,7 +12,9 @@ package org.eclipse.xtend.typesystem.uml2.profile; > > import java.io.File; > import java.io.IOException; >+import java.util.HashMap; > import java.util.List; >+import java.util.Map; > > import org.apache.commons.logging.Log; > import org.apache.commons.logging.LogFactory; >@@ -81,6 +83,11 @@ public class ProfilingExtensions { > } > } > >+ /* >+ * Caching Profiling Extensions fixes memory leaks. >+ */ >+ private static final Map<String, Profile> ourProfileCache = new HashMap<String, Profile>(1); >+ > /** > * Applies a profile to a Package (or Model). > * @param model The UML Package instance. >@@ -88,17 +95,41 @@ public class ProfilingExtensions { > * @return The loaded Profile > */ > public static Profile applyProfile (org.eclipse.uml2.uml.Package pck, String uri) { >+ return applyProfile2(pck, uri, false); >+ } >+ >+ /** >+ * Applies a profile to a Package (or Model). >+ * @param model The UML Package instance. >+ * @param uri Resource Path to the .profile.uml/.profile.uml2 file. >+ * @param cacheProfile true if profile should be cached >+ * @return The loaded Profile >+ */ >+ public static Profile applyProfile2 (org.eclipse.uml2.uml.Package pck, String uri, java.lang.Boolean cacheProfile) { > new Setup().setStandardUML2Setup(true);//setup pathmap > if (!uri.endsWith(".profile.uml2") && !uri.endsWith(".profile.uml")) { > uri += ".profile.uml"; > } >- Profile profile = (Profile) new XmiReader().load(uri); >+ Profile profile; >+ if (cacheProfile) { >+ profile = getProfileForURI(uri); >+ } else { >+ profile = (Profile) new XmiReader().load(uri); >+ } > if (profile==null) { > throw new NullPointerException("Profile '"+uri+"' not loaded."); > } > pck.applyProfile(profile); > return profile; > } >+ >+ protected static synchronized Profile getProfileForURI(String profileURI) { >+ if (!ourProfileCache.containsKey(profileURI)) { >+ Profile profile = (Profile) new XmiReader().load(profileURI); >+ ourProfileCache.put(profileURI, profile); >+ } >+ return ourProfileCache.get(profileURI); >+ } > > /** > * Applies a stereotype by name to an Element. >diff --git a/plugins/org.eclipse.xtend.typesystem.uml2/src/org/eclipse/xtend/typesystem/uml2/profile/profiling.ext b/plugins/org.eclipse.xtend.typesystem.uml2/src/org/eclipse/xtend/typesystem/uml2/profile/profiling.ext >index aa6d3c0..81869fc 100644 >--- a/plugins/org.eclipse.xtend.typesystem.uml2/src/org/eclipse/xtend/typesystem/uml2/profile/profiling.ext >+++ b/plugins/org.eclipse.xtend.typesystem.uml2/src/org/eclipse/xtend/typesystem/uml2/profile/profiling.ext >@@ -4,9 +4,11 @@ import uml; > Standard UML2 Extensions for Profile support. > */ > >-Profile applyProfile (Model model, String uri) : >+Profile applyProfile (Package model, String uri) : > JAVA org.eclipse.xtend.typesystem.uml2.profile.ProfilingExtensions.applyProfile(org.eclipse.uml2.uml.Package, java.lang.String); > >+Profile applyProfile (Package model, String uri, Boolean cacheProfile) : >+ JAVA org.eclipse.xtend.typesystem.uml2.profile.ProfilingExtensions.applyProfile2(org.eclipse.uml2.uml.Package, java.lang.String, java.lang.Boolean); > > cached Stereotype getStereotype (Model m, String stereotype) : > m.getAppliedProfiles().allOwnedElements().typeSelect(Stereotype).select(st|st.qualifiedName==stereotype).first(); >-- >1.7.4.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 361382
:
205511
|
205517
|
205520
| 205531