Disabling Notifications on ResourceSet.clear [message #1780542] |
Tue, 23 January 2018 19:30 |
|
i want to disable notifications on resouceset clearing for performance reasons
so i do the following
rs.eSetDeliver(false);
but this seems not to be sufficient cause the resources and resoureset are inverses
do i additionally have to do this:
for (Resource r : rs.getResources()) {
r.eSetDeliver(false);
}
do i oversee something or is that the only way
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
Re: Disabling Notifications on ResourceSet.clear [message #1780592 is a reply to message #1780588] |
Wed, 24 January 2018 08:58 |
|
the problem is we have 380000 resources and the building/merging of the notifications is slow. if there is any adapter and/or delivering not turned off
public class Main {
public static void main(String[] args) {
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("xmi", new ResourceFactoryImpl());
ResourceSet rs = new ResourceSetImpl();
AdapterImpl a = new AdapterImpl();
rs.eAdapters().add(a);
rs.eSetDeliver(false);
for (int i = 0; i < 380000;i++) {
if (i%1000==0) {
System.out.println(i);
}
Resource r = rs.createResource(URI.createURI("dummy_"+i+".xmi"));
r.eAdapters().add(a);
}
System.out.println("clearers gonna clear");
rs.eSetDeliver(false);
for (Resource r : rs.getResources()) {
// r.eSetDeliver(false);
}
rs.getResources().clear();
rs.eAdapters().clear();
System.out.println("done");
}
}
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03584 seconds