KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > modfact > jmi > ps > TestMemoryLoad


1 package org.objectweb.modfact.jmi.ps;
2
3 import javax.jmi.reflect.*;
4 import java.util.*;
5
6
7 /**
8  * @author gregory
9  * Test memory load in a basic way !
10  * not stable !!!
11  */

12 public class TestMemoryLoad{
13
14     public static void main(String JavaDoc[] args) throws Exception JavaDoc {
15
16         PersistantService pms = new PersistantService();
17         
18         Vector p = new Vector();
19         RefPackage p2, p3, p4 = null;
20         int maxModels = 10;
21
22         PersistantHelper.printFreeMemory("before programm");
23
24
25 // RefPackage p;
26
// XmiReader reader = new XmiReader_impl();
27
// p = RefPackage_impl.getM2Repository();
28
//
29
// reader.read("file:///C:/Documents and Settings/gregory/Bureau/Doc/Metamodels/samples/samples/simpleTRL.xml",p);
30

31         
32         
33         PersistantHelper ph = new PersistantHelper();
34
35         //reading one meta model
36
pms.load("THEXMLMODEL");
37         PersistantHelper.printFreeMemory("after loadind the XML etamodel");
38
39         //reading many metamodels
40
for (int i = 0; i < maxModels; i++) {
41             pms.load("SIMPLE_TRL");
42             PersistantHelper.printFreeMemory("after loadind the SIMPLE TRL metamodel " + i);
43         }
44
45         //writing the SIMPLE TRL metamodels
46
for (int i = 0; i < maxModels; i++) {
47
48             pms.store("SIMPLE_TRL");
49             PersistantHelper.printFreeMemory("after writing the metamodel SIMPLE TRL " + i);
50         }
51         
52         //writing the XML metamodel
53
pms.store( "THEXMLMODE");
54         PersistantHelper.printFreeMemory("after writing the metamodel XML MODEL");
55
56     }
57 }
58
Popular Tags