Précédent   Forum des professionnels en informatique > Java > Général Java > Langage
Langage Forum d'entraide sur le langage Java et autres langages pour la JVM : syntaxe, POO, conventions, API standard. Avant de poster -> FAQ Java
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 08/02/2012, 16h00   #1
Invité de passage
 
Femme
Étudiant
Inscription : février 2012
Messages : 9
Détails du profil
Informations personnelles :
Sexe : Femme
Localisation : France, Val de Marne (Île de France)

Informations professionnelles :
Activité : Étudiant
Secteur : High Tech - Matériel informatique

Informations forums :
Inscription : février 2012
Messages : 9
Points : 0
Points : 0
Par défaut Fuites mémoire dans une classe "java.util.HashMap$Entry"

Bonjour,

Après avoir lu ce topic (http://www.developpez.net/forums/d54...fuite-memoire/) je comprends un peu ce qu'est une fuite mémoire ou pas. Mais moi je rencontre une énorme fuite mémoire sur mon programme que j'ai analysé avec memory analyser tool. Ce profiler m'a indiqué la classe qui a un problème mais je n'arrive pas à comprendre cet histoire de référencement. Je pense que c'est une map qui se remplie et qui gonfle ma mémoire mais pas sur. Je mets un bout de mon code :
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
public class PCCACalculator {
 
	private static Logger log = Logger.getLogger(PCCACalculator.class);
 
	private static PCCACalculator INSTANCE;
	private static Map<String, FormulaContextResolver> mapFormulaContextResolver;
	private static Map<String, OperandContextResolver> mapOperandContextResolver;
 
 
	public PCCACalculator()  throws PCCACalculatorException, PCCAException {
		final String METH = ".PCCACalculator(): ";
 
		mapFormulaContextResolver = new HashMap<String, FormulaContextResolver>();
		mapOperandContextResolver = new HashMap<String, OperandContextResolver>();
 
 
public static PCCACalculator getInstance() throws PCCACalculatorException, PCCAException {
		if (INSTANCE == null) {
			INSTANCE = new PCCACalculator();
		}
		return INSTANCE;
	}
Je pense que c'est aux accès deux niveaux qu'il y a un problème de GC qui finit pas son travail sur l'instance. Pourriez vous m'aidez SVP ?

Je suis sous Eclipse JDK 1.6
ladyingold est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 08/02/2012, 16h46   #2
Modérateur
 
Avatar de Robin56
 
Homme Nicolas
Ingénieur développement logiciels
Inscription : juin 2009
Messages : 1 715
Détails du profil
Informations personnelles :
Nom : Homme Nicolas
Localisation : France

Informations professionnelles :
Activité : Ingénieur développement logiciels

Informations forums :
Inscription : juin 2009
Messages : 1 715
Points : 4 826
Points : 4 826
Ton code joint ne nous donne pas assez d'information puisqu'il ne s'agit seulement que de l'initialisation des Map. Ce que je peux remarquer en tout cas c'est que tu as un Singleton avec des Map en static également mais c'est difficile d'en conclure quelque chose avec ces seuls éléments.
__________________
Robin56 est déconnecté   Envoyer un message privé Réponse avec citation 10
Vieux 08/02/2012, 18h06   #3
Expert Confirmé Sénior
 
Inscription : septembre 2004
Messages : 5 099
Détails du profil
Informations forums :
Inscription : septembre 2004
Messages : 5 099
Points : 7 025
Points : 7 025
Citation:
Envoyé par ladyingold Voir le message
Je pense que c'est une map qui se remplie et qui gonfle ma mémoire mais pas sur.
Ben, ça se tient.

Vérifie où et quand tu mets des choses dans ces maps.
Vérifie si tu ne passes pas ton temps à y mettre sans arrêt de nouvelles choses (auquel cas, ce n'est pas une fuite mémoire, c'est juste que tu mets de plus en plus de choses en mémoire et qu'à un moment il n'y en a plus assez.)
Vérifie si tu penses à en enlever tout ce qui ne sert plus.
thelvin est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 09/02/2012, 11h28   #4
Invité de passage
 
Femme
Étudiant
Inscription : février 2012
Messages : 9
Détails du profil
Informations personnelles :
Sexe : Femme
Localisation : France, Val de Marne (Île de France)

Informations professionnelles :
Activité : Étudiant
Secteur : High Tech - Matériel informatique

Informations forums :
Inscription : février 2012
Messages : 9
Points : 0
Points : 0
Alors j'ai regardé le moment ou les maps se remplissent et en effet je remplis les maps mais de "value" mais pour ce remplissage n'est pas indéfini...
Comment libère t'on une map sil te plait?
ladyingold est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 09/02/2012, 11h46   #5
Modérateur
 
Avatar de Robin56
 
Homme Nicolas
Ingénieur développement logiciels
Inscription : juin 2009
Messages : 1 715
Détails du profil
Informations personnelles :
Nom : Homme Nicolas
Localisation : France

Informations professionnelles :
Activité : Ingénieur développement logiciels

Informations forums :
Inscription : juin 2009
Messages : 1 715
Points : 4 826
Points : 4 826
Citation:
Envoyé par ladyingold Voir le message
je remplis les maps mais de "value" mais pour ce remplissage n'est pas indéfini...
Voir le code de ton remplissage de Map nous aiderait davantage car je n'ai pas saisis cette partie de ta phrase.
__________________
Robin56 est déconnecté   Envoyer un message privé Réponse avec citation 10
Vieux 09/02/2012, 12h06   #6
Invité de passage
 
Femme
Étudiant
Inscription : février 2012
Messages : 9
Détails du profil
Informations personnelles :
Sexe : Femme
Localisation : France, Val de Marne (Île de France)

Informations professionnelles :
Activité : Étudiant
Secteur : High Tech - Matériel informatique

Informations forums :
Inscription : février 2012
Messages : 9
Points : 0
Points : 0
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
public class PCCACalculator {
 
	private static Logger log = Logger.getLogger(PCCACalculator.class);
 
	private static PCCACalculator INSTANCE;
	private static Map<String, FormulaContextResolver> mapFormulaContextResolver;
	private static Map<String, OperandContextResolver> mapOperandContextResolver;
 
 
	public PCCACalculator()  throws PCCACalculatorException, PCCAException {
		final String METH = ".PCCACalculator(): ";
 
		mapFormulaContextResolver = new HashMap<String, FormulaContextResolver>();
		mapOperandContextResolver = new HashMap<String, OperandContextResolver>();
 
		// Configuration de calcul Attribut OI (Order Intake) - uniquement cumul agregat
		configCalculWithEmptyFormula(AttributName.OrderIntake.value());
		// Configuration de calcul Attribut R (Revenue) - uniquement cumul agregat
		configCalculWithEmptyFormula(AttributName.Revenue.value());
		// Configuration de calcul Attribut CV (Cost Variance) - uniquement cumul agregat
		configCalculWithEmptyFormula(AttributName.CostVariance.value());
		// Configuration de calcul Attribut WOI (Weighted Order Intake), avec attribut operande : OI (Order Intake) 
		configCalculWithWeightingFormula(AttributName.WeightedOrderIntake.value(), AttributName.OrderIntake.value());
		// Configuration de calcul Attribut WR (Weighted Revenue), avec attribut operande : R (Revenue) 
		configCalculWithWeightingFormula(AttributName.WeightedRevenue.value(), AttributName.Revenue.value());
		// Configuration de calcul Attribut OB (OrderBook), avec attributs operandes : WOI (Weighted Order Intake), WR (Weighted Revenue) 
		configCalculWithApplicatorCumulationOrderBookFormula(AttributName.OrderBook.value(), AttributName.WeightedOrderIntake.value(), AttributName.WeightedRevenue.value());
		// Configuration de calcul Attribut WOIGM (Gross Margin on Order Intake weighted), avec attribut operande : WOI (Weighted Order Intake) 
		configCalculWithGrossMarginFormula(AttributName.WeightedOrderIntakeGM.value(), AttributName.WeightedOrderIntake.value());
		// Configuration de calcul Attribut WRGM (Gross Margin on Revenue weighted), avec attribut operande : WR (Weighted Revenue) 
		configCalculWithGrossMarginFormula(AttributName.WeightedRevenueGM.value(), AttributName.WeightedRevenue.value());
		// Configuration de calcul Attribut WCV (Weighted Cost Variance on GM), avec attribut operande : CV (CostVariance), WR (Weighted Revenue) 
		configCalculWithWeightingCostVarianceFormula(AttributName.WeightedCostVariance.value(), AttributName.CostVariance.value(), AttributName.WeightedRevenue.value());
		// Configuration de calcul Attribut AWRGM (Adjusted Gross Margin on Revenue balanced), avec attributs operandes : WRGM (Gross Margin on Revenue weighted), WCV (WeeightedCostVariance) 
		configCalculWithSumFormula(AttributName.AdjustedWeightedRevenueGM.value(), AttributName.WeightedRevenueGM.value(), AttributName.WeightedCostVariance.value());	
		// Configuration de calcul Attribut isWR (internal somme Weighted Revenue), avec attribut operande : (WR) Weighted Revenue 
		configCalculWithApplicatorCumulationIdemFormula(AttributName.internalsommeWeightedRevenue.value(), AttributName.WeightedRevenue.value());
		// Configuration de calcul Attribut isWCV (internal somme Weighted Cost Variance on GM), avec attribut operande : WCV (Weighted Cost Variance on GM) 
		configCalculWithApplicatorCumulationIdemFormula(AttributName.internalsommeWeightedCostVariance.value(), AttributName.WeightedCostVariance.value());		
		// Configuration de calcul Attribut AGM% (Adjusted Gross Margin to calculate current & future), avec attributs operandes : isWCV (Weighted Cost Variance on GM), isWR (Weighted Revenue) 
		configCalculWithPercentAdjustedGrossMarginFormula(AttributName.AdjustedGrossMargin.value(), AttributName.internalsommeWeightedCostVariance.value(), AttributName.internalsommeWeightedRevenue.value());	
 
		log.debug(METH+"mapFormulaContextResolver:"+mapFormulaContextResolver.toString());
		log.debug(METH+"mapOperandContextResolver:"+mapOperandContextResolver.toString());
	}
 
	public static PCCACalculator getInstance() throws PCCACalculatorException, PCCAException {
		if (INSTANCE == null) {
			INSTANCE = new PCCACalculator();
		}
		return INSTANCE;
	}	
 
 
 
	public void loadOrCalculPCCAProgram(PCCAResult pccaResult, EntityManager em) throws PCCAException, CalculatorException, PCCACalculatorException, PCCADataException, PCCADataRulesException, ContextResolverException
	{
		// Si le flag concerne dans la base de donnee est a 0 on fait les calculs
		if( PCCAAdmin.getSingletonPCCAAdmin(em).getPersistAttribCalculPastOn() )
			this.loadPCCAProgram( pccaResult, em );
		else
			this.calculPCCAProgram( pccaResult, em );
	}
 
 
	public void calculPCCAProgram(final PCCAResult pccaResult, EntityManager em) throws PCCACalculatorException, PCCAException, PCCADataException, CalculatorException, ContextResolverException, PCCADataRulesException {
		if (null != pccaResult) {
			// Reinitialisation de l'indicteur de calcul
			pccaResult.getPeriodCalculStatus().resetFullIsCalculated(em);
 
			this.calculParamAndAttributes( pccaResult, em );
		}
	}		
 
	public void loadOrCalculPCCAPrograms(final PCCASynthesis pccaSynthesis, EntityManager em) throws PCCACalculatorException, PCCAException, PCCADataException, CalculatorException, ContextResolverException, PCCADataRulesException {
		final String METH = ".calculPCCAPrograms(): ";
		log.debug(METH+"begin");
		if (null != pccaSynthesis && !pccaSynthesis.getMapPCCAResult().isEmpty()) {
 
			// Calcul du PCCAResult de chaque Program
			for (String progNumber : pccaSynthesis.getMapPCCAResult().keySet()) {
				loadOrCalculPCCAProgram(pccaSynthesis.getPCCAResult(progNumber), em);
			}
 
			// Calcul des Agregats de periodes pour l'ensemble des programs
			final Map<String, List<Map<String, Float>>> mapPCCAProgramsGrpByAttribut = getMapPCCAProgramsGrpByAttribut(pccaSynthesis.getMapPCCAResult(), em);
			for (String attributName : mapPCCAProgramsGrpByAttribut.keySet()) {
				if (!AttributName.isInternalCalcul(attributName) && !(attributName.equals(AttributName.WeightedOrderIntakeGM.value()))) {
					final List<Map<String, Float>> mapValuesPrograms = mapPCCAProgramsGrpByAttribut.get(attributName);
					if (null != mapValuesPrograms && !mapValuesPrograms.isEmpty()) {
						Map<String, Float> mapAgregatPeriodForAttribut = Calculator.sommeContentMapByKey(mapValuesPrograms);
						pccaSynthesis.setMapSynth(attributName, mapAgregatPeriodForAttribut);
					}
				}
			}
 
		}
		log.debug(METH+"end");
	}
 
	/**
	 * Author : t0110926
	 * Date : 06/12/10
	 * 
	 * Methode permettant d'affecter a pccaResult les valeurs chargees depuis la base de donnes pour le passe
	 * et de calculer la valeur pour le futur
	 * 
	 * Resolution anomalie Mantis 101
	 * @param pccaResult
	 * @param em
	 * @throws PCCAException 
	 * @throws ContextResolverException 
	 * @throws PCCADataRulesException 
	 * @throws PCCADataException 
	 * @throws PCCACalculatorException 
	 * @throws CalculatorException 
	 */
	public void loadPCCAProgram(PCCAResult pccaResult, EntityManager em) throws PCCAException, CalculatorException, PCCACalculatorException, PCCADataException, PCCADataRulesException, ContextResolverException {
		if (null != pccaResult) {
			// Reinitialisation de l'indicteur de calcul
			pccaResult.getPeriodCalculStatus().resetFullIsCalculated(em);
			Map<String,Map<String,Float>> map = pccaResult.loadMapDataCalculated(em);
 
			// On charge les donnes pour la periode passee et on valide le fait qu'ils sont calcules
			for (String attribut : map.keySet()){
				pccaResult.setMapData(map.get(attribut), attribut);
				pccaResult.getPeriodCalculStatus().setIsCalculatedForPastPeriods(pccaResult.getPeriodResolver(), attribut);
			}
 
			this.calculParamAndAttributes( pccaResult, em );
		}
 
	}
 
	private void calculParamAndAttributes( PCCAResult pccaResult, EntityManager em )
			throws PCCAException, CalculatorException, PCCACalculatorException, PCCADataException, PCCADataRulesException, ContextResolverException
	{
		if (checkAttributsContents(pccaResult, em)) { 
			if( ProgramUtils.isOpportunity( pccaResult.getProgNumber() ) )
				setParamWithParam(ParamName.InitialGrossMargin.value(), ParamName.CurrentAdjustedGrossMargin.value(), pccaResult, em);
			// Calcul Attribut OI (Order Intake) - uniquement cumul agregat
			calculAttribut(AttributName.OrderIntake.value(), pccaResult, em);
			// Calcul Attribut R (Revenue) - uniquement cumul agregat
			calculAttribut(AttributName.Revenue.value(), pccaResult, em);
			// Calcul Attribut CV (Cost Variance) - uniquement cumul agregat
			calculAttribut(AttributName.CostVariance.value(), pccaResult, em);
			// Calcul Attribut WOI (Weighted Order Intake)
			calculAttribut(AttributName.WeightedOrderIntake.value(), pccaResult, em);			
			// Calcul Attribut WR (WeightedRevenue)
			calculAttribut(AttributName.WeightedRevenue.value(), pccaResult, em);
			// Calcul Attribut OB (Order Book)
			calculAttribut(AttributName.OrderBook.value(), pccaResult, em);
			// Calcul Attribut WOIGM (Gross Margin on Order Intake weighted)
			calculAttribut(AttributName.WeightedOrderIntakeGM.value(), pccaResult, em);
			// Calcul Attribut WRGM (Gross Margin on Revenue weighted)
			calculAttribut(AttributName.WeightedRevenueGM.value(), pccaResult, em);
			// Calcul Attribut WCV (Weighted Cost Variance on GM)
			calculAttribut(AttributName.WeightedCostVariance.value(), pccaResult, em);
			// Calcul Attribut AWRGM (Adjusted Gross Margin on Revenue balanced)
			calculAttribut(AttributName.AdjustedWeightedRevenueGM.value(), pccaResult, em);
			// Calcul Attribut isWR (internal somme Weighted Revenue)
			calculAttribut(AttributName.internalsommeWeightedRevenue.value(), pccaResult, em);
			// Calcul Attribut isWCV (internal somme Weighted Cost Variance on GM)
			calculAttribut(AttributName.internalsommeWeightedCostVariance.value(), pccaResult, em);
			// Calcul Attribut AGM% (Adjusted Gross Margin to calculate current & future)
			calculAttribut(AttributName.AdjustedGrossMargin.value(), pccaResult, em);
			// Affectation Attribut AGM% (Adjusted Gross Margin to calculate current & future) periode Passee au Parametre CAGM (Current Adjusted Gross Margin)
			//setParamWithAttribut(AttributName.AdjustedGrossMargin.value(), PeriodResolver.getKeyPeriodAgregatPast(), ParamName.CurrentAdjustedGrossMargin.value(), pccaResult, em);
			// Affectation Attribut AGM% (Adjusted Gross Margin to calculate current & future) periode agregat Ensemble Program au Parametre FAGM (FutureAdjustedGrossMargin)
			setParamWithAttribut(AttributName.AdjustedGrossMargin.value(), PeriodResolver.getKeyPeriodAgregatRootProg(), ParamName.FutureAdjustedGrossMargin.value(), pccaResult, em);
		}
	}
 
	private Map<String, List<Map<String, Float>>> getMapPCCAProgramsGrpByAttribut(final Map<String, PCCAResult> mapPCCAResult, EntityManager em) throws PCCACalculatorException, PCCADataException, PCCAException, PCCADataRulesException {
		final String METH = ".getMapPCCAProgramsGrpByAttributAndPeriod(): ";
		log.debug(METH+"begin");
		final Map<String, List<Map<String, Float>>> mapValuesPrograms = new HashMap<String, List<Map<String, Float>>>();
		if ( mapPCCAResult != null && !mapPCCAResult.isEmpty()) {
			for (AttributName attributName : AttributName.getListAllWithoutInternalCalculs()) {
				final List<Map<String, Float>> listMapsPeriodValuesProgramsForAttribut = getListMapsPeriodValuesProgramsForAttribut(attributName.value(), mapPCCAResult, em);
				mapValuesPrograms.put(attributName.value(), listMapsPeriodValuesProgramsForAttribut);
			}
		}
		log.debug(METH+"end");
		return mapValuesPrograms;
	}
 
	private List<Map<String, Float>> getListMapsPeriodValuesProgramsForAttribut(final String attributName, final Map<String, PCCAResult> mapPCCAResult, EntityManager em) throws PCCACalculatorException, PCCADataException, PCCAException, PCCADataRulesException {
		final String METH = ".getMapAgregatAttribut(): ";
		log.debug(METH+"begin");
		final List<Map<String, Float>> listMapsPeriodValuesPrograms = new ArrayList<Map<String, Float>>();
		if ( mapPCCAResult != null && !mapPCCAResult.isEmpty()){
			for (String progNumber : mapPCCAResult.keySet()) {
				Map<String, Float> mapDataAttributProgram = new HashMap<String, Float>();
				mapDataAttributProgram = mapPCCAResult.get(progNumber).getMapData(attributName, em);
				if (null != mapDataAttributProgram && !mapDataAttributProgram.isEmpty()) {
					listMapsPeriodValuesPrograms.add(mapDataAttributProgram);
				}
			}
		}
		log.debug(METH+"end");
		return listMapsPeriodValuesPrograms;
	}	
 
	private boolean checkAttributsContents(final PCCAResult pccaResult,EntityManager em) throws PCCACalculatorException, PCCADataException, PCCAException, PCCADataRulesException {
		final String METH = ".checkAttributsContents(): ";
		log.debug(METH+"begin");
		boolean isCheckAttributsContentsValid = true;
 
		/**
 
		 * 10/11/2010 : Modification
 
		 *
 
		 * Prise en compte des exigences EB_F05-Capture, EB_F07-Capture, EB_F08-Capture, EB_F09-Capture et EB_F10-Capture
		 * Traitement de l'anomalie 71 definie dans Mantis
 
		 * Suppression de la condition liste vide sur les "if"
		 * Le calcul doit pouvoir etre lance meme si aucune valeur n'est renseignee pour OI, R ou CV
 
		 */
 
		// Verification existance Attribut OI (Order Intake)
		//if (null == pccaResult.getMapData(AttributName.OrderIntake.value(), em) || pccaResult.getMapData(AttributName.OrderIntake.value(), em).isEmpty()) {
		if (null == pccaResult.getMapData(AttributName.OrderIntake.value(), em)) {
			isCheckAttributsContentsValid = false;
		}
		// Verification existance Attribut R (Revenue)
		//if (null == pccaResult.getMapData(AttributName.Revenue.value(), em) || pccaResult.getMapData(AttributName.Revenue.value(), em).isEmpty()) {
		if (null == pccaResult.getMapData(AttributName.Revenue.value(), em)) {
			isCheckAttributsContentsValid = false;
		}
		// Verification existance Attribut CV (Cost Variance)
		//if (null == pccaResult.getMapData(AttributName.CostVariance.value(), em) || pccaResult.getMapData(AttributName.CostVariance.value(), em).isEmpty()) {
		if (null == pccaResult.getMapData(AttributName.CostVariance.value(), em)) {	
			isCheckAttributsContentsValid = false;
		}
		// Si attributs, Verification Params
		if (isCheckAttributsContentsValid) {
			pccaResult.checkMapParamForCalcul();
		}
		log.debug(METH+"end-isCheckAttributsContentsValid:"+isCheckAttributsContentsValid);
		return isCheckAttributsContentsValid;
	}		
 
 
	private void setParamWithAttribut(final String attribKey, final String periodKey, final String paramKey , PCCAResult pccaResult, EntityManager em) throws PCCACalculatorException, PCCADataException, PCCAException, PCCADataRulesException {
		final String METH = ".setParamWithAttribut(): ";
		log.debug(METH+"begin-attribKey:"+attribKey+", periodKey:"+periodKey+", paramKey:"+paramKey);
		Float value = null;
		//Modification pour le calcul de FAGM
		// fait par T0125118 le 12/07/11
		if(paramKey.equalsIgnoreCase("FAGM"))
			value = calculFAGM(pccaResult, em) ;
		// Recuperation valeur attribut
		else{
			if (null != pccaResult.getMapData(attribKey, em) || !pccaResult.getMapData(attribKey, em).isEmpty()) {
				value = pccaResult.getMapData(attribKey, em).get(periodKey);	
			}
		}
		log.debug(METH+"value:"+value);
		// Affectation du Parametre
		pccaResult.setValueParam(value, paramKey);
		log.debug(METH+"end-value:"+pccaResult.getValueParam(paramKey, em));
	}	
 
	/**
	 * @author t0125118
	 * @brief La fonction calcule la Futur Adjust Gross Margin en sommant les CV et les R conformément à la formule
	 * 		donnée dans les specs
	 * @param pccaResult
	 * 		La map de données
	 * @param em
	 * 		Entity Manager pour la persistence
	 * @return
	 * 		La FAGM
	 * @throws PCCADataException
	 * @throws PCCAException
	 * @throws PCCADataRulesException
	 */
 
 
	private Float calculFAGM(PCCAResult pccaResult, EntityManager em) throws PCCADataException, PCCAException, PCCADataRulesException {
 
		/* 
 
		 L'objectif de cette fonction est de calculer la formule : 
		  	FAGM = InitialMargin + Somme des WCV / Somme des WR
 
		  	Avec : 
		  	- Somme des WCV = CV depuis le debut du projet + (p1 x p2) x WCV futurs
		  	- Somme des WR  = R  depuis le debut du projet + (p1 x p2) x WR  futurs
 
		 */
		Float cvMc,cvA1,cvA2,rMc,rA1,rA2;
 
		Map<String,Float> mapCV = pccaResult.getMapData("CV", em);
		Map<String,Float> mapR  = pccaResult.getMapData("R", em);
 
 
		// AGM
		Float intialMargin    = pccaResult.getMapParam(em).get(ParamName.InitialGrossMargin.value());
 
		// CAGM
		Float currentMargin   = pccaResult.getMapParam(em).get(ParamName.CurrentAdjustedGrossMargin.value());
 
		// AGM - CAGM
		Float rapportMargin   = currentMargin/100 - intialMargin;
 
		//P1
		Float p1   			  = pccaResult.getMapParam(em).get(ParamName.POne.value());
		//P2
		Float p2		      = pccaResult.getMapParam(em).get(ParamName.PTwo.value());
 
 
		if(mapCV.containsKey("Agr_MC-M12_A00"))
			cvMc = Float.valueOf(mapCV.get("Agr_MC-M12_A00"));
		else
			cvMc = new Float(0);
 
		if(mapCV.containsKey("Agr_A01")){
			cvA1 = Float.valueOf(mapCV.get("Agr_A01"));
		}
		else{
			cvA1 = new Float(0);
		}
		if(mapCV.containsKey("A02"))
			cvA2 = Float.valueOf(mapCV.get("A02"));
		else
			cvA2 = new Float(0);
 
		if(mapR.containsKey("Agr_MC-M12_A00"))
			rMc = Float.valueOf(mapR.get("Agr_MC-M12_A00"));
		else
			rMc = new Float(0);
		if(mapR.containsKey("Agr_A01")){
			rA1 = Float.valueOf(mapR.get("Agr_A01"));
		}
		else{
			rA1 = new Float(0);
		}
		if(mapR.containsKey("A02"))
			rA2 = Float.valueOf(mapR.get("A02"));
		else
			rA2 = new Float(0);	
 
 
		Float total_WCV =  Float.valueOf(mapCV.get("Agr_Prog-MC")) + //total CV passés
						  (p1 * p2 ) *( rapportMargin *  rMc  + cvMc ) + //total CV année courante
						  (p1 * p2 ) *( rapportMargin *  rA1  + cvA1 ) + //total CV année n+1
						  (p1 * p2 ) *( rapportMargin *  rA2  + cvA2 ); //total CV année n+2
 
		Float total_WR  =  Float.valueOf(mapR.get( "Agr_Prog-MC")) + //total R passés
						  (p1 * p2 ) * rMc + //total R  année courante
						  (p1 * p2 ) * rA1 + //total R année n+1
						  (p1 * p2 ) * rA2; //total R année n+2
 
 
		if ( total_WR != 0)
			return intialMargin + (total_WCV/total_WR);
		else
			return intialMargin; 
 
 
 
	}
 
 
	private void setParamWithParam( final String paramSourceKey, final String paramTargetKey, PCCAResult pccaResult, EntityManager em )
			throws PCCACalculatorException, PCCADataException, PCCAException, PCCADataRulesException
	{
		final String METH = ".setParamWithParam(): ";
		log.debug(METH+"begin-paramSourceKey:"+paramSourceKey+", paramTargetKey:"+paramTargetKey);
		// Recuperation valeur parametre source
		float sourceValue = pccaResult.getValueParam(paramSourceKey, em);
		log.debug(METH+"sourceValue:"+sourceValue);
		if( ParamName.InitialGrossMargin.value().equals( paramSourceKey ) )
			sourceValue *= 100;
		if( ParamName.InitialGrossMargin.value().equals( paramTargetKey ) )
			sourceValue /= 100;
		log.debug(METH+"targetValue:"+sourceValue);
		// Affectation du parametre cible
		pccaResult.setValueParam(sourceValue, paramTargetKey);
		log.debug(METH+"end");
	}	
 
	private void calculAttribut(String aKey, PCCAResult pccaResult, EntityManager em) throws PCCACalculatorException, CalculatorException, ContextResolverException, PCCADataException, PCCAException, PCCADataRulesException {
		final String METH = ".calculAttribut(): ";
		log.debug(METH+"///////////////////////////////////////////////////////////////////////////");
		log.debug(METH+"begin-Calcul:"+aKey);
		// Calcul Attribut
		AttributCalculator attribCalcul = new AttributCalculator(aKey, mapFormulaContextResolver.get(aKey), mapOperandContextResolver.get(aKey), pccaResult);
		attribCalcul.calcul(pccaResult.getPeriodResolver(), em);
		log.debug(METH+"end-Calcul:"+aKey);
		log.debug(METH+"///////////////////////////////////////////////////////////////////////////");
	}	
 
	// Configuration du Calcul des Attributs
	////////////////////////////////////////
 
	private void configCalculWithEmptyFormula(final String aKey) throws PCCACalculatorException {
		// Configuration de calcul Attribut sans formule - uniquement cumul agregat
		FormulaContextResolver formulaContextResolver = new FormulaContextResolver(aKey);
		mapFormulaContextResolver.put(aKey, formulaContextResolver);
 
		// Configuration de l'algorithme par defaut : EmptyFormula - c'est-a-dire pas de formule
		FormulaDescriptor formulaDescriptor = new FormulaDescriptor(FormulaName.Empty.value()); 
		FormulaCtxDescriptor formulaCtxDescriptor = new FormulaCtxDescriptor(formulaDescriptor);
		formulaContextResolver.setCtxDefault(formulaCtxDescriptor);
	}	
 
	private void configCalculWithWeightingFormula(final String aKey, final String aOperKey) throws PCCACalculatorException, PCCAException {
		final String METH = ".configCalculWithWeightingFormula(): ";	
		// Configuration de calcul Attribut avec formule Weighting		
		FormulaContextResolver formulaContextResolver = new FormulaContextResolver(aKey);
		mapFormulaContextResolver.put(aKey, formulaContextResolver);
		OperandContextResolver operandContextResolver = new OperandContextResolver(aKey);
		mapOperandContextResolver.put(aKey, operandContextResolver);
 
		// Configuration de l'algorithme par defaut : WeightingFormula, avec les parametres P1 et P2
		FormulaDescriptor formulaDescriptorDefault = new FormulaDescriptor(FormulaName.Weighting.value(), ParamName.POne.value(), ParamName.PTwo.value()); 
		log.debug(METH+"formulaDescriptorDefault:"+((formulaDescriptorDefault==null)?"null":formulaDescriptorDefault.toString()));
		FormulaCtxDescriptor formulaCtxDescriptorDefault = new FormulaCtxDescriptor(formulaDescriptorDefault);
		formulaContextResolver.setCtxDefault(formulaCtxDescriptorDefault);
		// Configuration de l'operande associee a l'algorithme par defaut : attribut operande : aOperKey 
		ListOrderedOperAttributDesc listOrderedOperAttributDescDefault = new ListOrderedOperAttributDesc();
		listOrderedOperAttributDescDefault.addKeyAttribut(aOperKey);
		operandContextResolver.setCtxDefault(listOrderedOperAttributDescDefault);
 
		// Configuration de l'algorithme explicite pour les periodes du passe, selectionnees par Selecteur PastPeriodSelector : WeightingFormula, avec le parametre scalaire 1 (representant P1=P2=1)
		//     On a donc pour le passe : WR = R, WOI = OI, etc ...
		FormulaDescriptor formulaDescriptorPeriodSelector = new FormulaDescriptor(FormulaName.Weighting.value(), ParamName.ScalaireValueOne.value(), ParamName.ScalaireValueOne.value());
		log.debug(METH+"formulaDescriptorPeriodSelector:"+((formulaDescriptorPeriodSelector==null)?"null":formulaDescriptorPeriodSelector.toString()));
		FormulaCtxDescriptor formulaCtxDescriptorPeriodSelector = new FormulaCtxDescriptor(formulaDescriptorPeriodSelector);
		formulaContextResolver.addCtxForPeriodSelector(PeriodSelectorName.PastPeriodSelector.value(), formulaCtxDescriptorPeriodSelector);		
	}	
 
	private void configCalculWithWeightingCostVarianceFormula( final String registeredKey, final String operCVKey, final String operWRKey ) throws PCCACalculatorException, PCCAException
	{
		final String METH = ".configCalculWithWeightingCostVarianceFormula(): ";
		// Configuration de calcul Attribut avec formule WeightingCostVariance
		FormulaContextResolver formulaContextResolver = new FormulaContextResolver( registeredKey );
		mapFormulaContextResolver.put( registeredKey, formulaContextResolver );
		OperandContextResolver operandContextResolver = new OperandContextResolver( registeredKey );
		mapOperandContextResolver.put( registeredKey, operandContextResolver );
 
		// Configuration de l'algorithme par defaut : WeightingCostVarianceFormula, avec les parametres P1, P2, GM, CAGM
		FormulaDescriptor formulaDescriptorDefault = new FormulaDescriptor( FormulaName.WeightingCostVariance.value(),
				ParamName.POne.value(), ParamName.PTwo.value(), ParamName.InitialGrossMargin.value(), ParamName.CurrentAdjustedGrossMargin.value() );
		log.debug(METH+"formulaDescriptorDefault:"+((formulaDescriptorDefault==null)?"null":formulaDescriptorDefault.toString()));
		FormulaCtxDescriptor formulaCtxDescriptorDefault = new FormulaCtxDescriptor( formulaDescriptorDefault );
		formulaContextResolver.setCtxDefault( formulaCtxDescriptorDefault );
		// Configuration des operandes associees a l'algorithme par defaut : attribut operande : operCVKey, operWRKey (CV, WR)
		ListOrderedOperAttributDesc listOrderedOperAttributDescDefault = new ListOrderedOperAttributDesc();
		listOrderedOperAttributDescDefault.addKeyAttribut( operCVKey );
		listOrderedOperAttributDescDefault.addKeyAttribut( operWRKey );
		operandContextResolver.setCtxDefault( listOrderedOperAttributDescDefault );
 
		// Configuration de l'algorithme explicite pour les periodes du passe, selectionnees par Selecteur PastPeriodSelector :
		//     WeightingFormula, avec le parametre scalaire 1 pour P1 et P2
		//     On a donc pour le passe : WCV = CV
		FormulaDescriptor formulaDescriptorPeriodSelector = new FormulaDescriptor( FormulaName.Weighting.value(), ParamName.ScalaireValueOne.value(), ParamName.ScalaireValueOne.value() );
		log.debug(METH+"formulaDescriptorPeriodSelector:"+((formulaDescriptorPeriodSelector==null)?"null":formulaDescriptorPeriodSelector.toString()));
		FormulaCtxDescriptor formulaCtxDescriptorPeriodSelector = new FormulaCtxDescriptor(formulaDescriptorPeriodSelector);
		formulaContextResolver.addCtxForPeriodSelector(PeriodSelectorName.PastPeriodSelector.value(), formulaCtxDescriptorPeriodSelector);
		// Configuration des operandes associees a l'algorithme explicite pour les periodes du passe : attribut operande : operCVKey (CV)
		ListOrderedOperAttributDesc listOrderedOperAttributDescPeriodSelector = new ListOrderedOperAttributDesc();
		listOrderedOperAttributDescPeriodSelector.addKeyAttribut( operCVKey );
		operandContextResolver.addCtxForPeriodSelector(PeriodSelectorName.PastPeriodSelector.value(), listOrderedOperAttributDescPeriodSelector);
	}
 
	private void configCalculWithApplicatorCumulationOrderBookFormula(final String aKey, final String aOperXKey, final String aOperYKey) throws PCCACalculatorException, PCCAException {
		final String METH = ".configCalculWithApplicatorCumulationOrderBookFormula(): ";
		// Configuration de calcul Attribut avec formule applicateur Cumulation et formule OrdersBooked
		FormulaContextResolver formulaContextResolver = new FormulaContextResolver(aKey);
		mapFormulaContextResolver.put(aKey, formulaContextResolver);
		OperandContextResolver operandContextResolver = new OperandContextResolver(aKey);
		mapOperandContextResolver.put(aKey, operandContextResolver);
 
		// Configuration de l'algorithme par defaut : OrdersBooked		
		FormulaDescriptor formulaDescriptorDefault = new FormulaDescriptor(FormulaName.OrdersBooked.value()); 
		log.debug(METH+"formulaDescriptorDefault:"+((formulaDescriptorDefault==null)?"null":formulaDescriptorDefault.toString()));
		ExpressionFormApplicatorDescriptor formApplicatorDescriptor = new ExpressionFormApplicatorDescriptor(FormulaApplicatorName.ExpressionCumulation.value()); 
		log.debug(METH+"formApplicatorDescriptor:"+((formApplicatorDescriptor==null)?"null":formApplicatorDescriptor.toString()));
		FormulaCtxDescriptor formulaCtxDescriptorDefault = new FormulaCtxDescriptor(formulaDescriptorDefault, formApplicatorDescriptor);
		formulaContextResolver.setCtxDefault(formulaCtxDescriptorDefault);
		// Configuration des operandes associees a l'algorithme par defaut : attributs operandes : WOI (Weighted Order Intake), WR (Weighted Revenue) 
		ListOrderedOperAttributDesc listOrderedOperAttributDescDefault = new ListOrderedOperAttributDesc();
		listOrderedOperAttributDescDefault.addKeyAttribut(aOperXKey);
		listOrderedOperAttributDescDefault.addKeyAttribut(aOperYKey);
		operandContextResolver.setCtxDefault(listOrderedOperAttributDescDefault);
 
		// Configuration de l'algorithme explicite pour les periodes type Agregat, selectionnees par Selecteur AgregatPeriodSelector : IdemFormula
		FormulaDescriptor formulaDescriptorPeriodSelector = new FormulaDescriptor(FormulaName.Idem.value());
		log.debug(METH+"formulaDescriptorPeriodSelector:"+((formulaDescriptorPeriodSelector==null)?"null":formulaDescriptorPeriodSelector.toString()));
		FormulaCtxDescriptor formulaCtxDescriptorPeriodSelector = new FormulaCtxDescriptor(formulaDescriptorPeriodSelector);
		formulaContextResolver.addCtxForPeriodSelector(PeriodSelectorName.AgregatPeriodSelector.value(), formulaCtxDescriptorPeriodSelector);
		// Configuration des operandes associees a l'algorithme explicite pour les periodes type Agregat : attribut operande : OB (Orders Booked) 
		ListOrderedOperAttributDesc listOrderedOperAttributDescPeriodSelector1 = new ListOrderedOperAttributDesc();
		listOrderedOperAttributDescPeriodSelector1.addOperAttribValuesDescriptor(new OperAttribValuesDescriptor(aKey, PeriodSelectorName.LastChildPeriodWithSameParentSelector));
		operandContextResolver.addCtxForPeriodSelector(PeriodSelectorName.AgregatPeriodSelector.value(), listOrderedOperAttributDescPeriodSelector1);
 
		// Configuration des operandes explicites associees a l'algorithme par defaut pour les periodes selectionnees par le Selecteur FirstChildPeriodSelector:
		// attributs operandes : OB (Orders Booked)   WOI (Weighted Order Intake), WR (Weighted Revenue)
		ListOrderedOperAttributDesc listOrderedOperAttributDescPeriodSelector2 = new ListOrderedOperAttributDesc();
		listOrderedOperAttributDescPeriodSelector2.addOperAttribValuesDescriptor(new OperAttribValuesDescriptor(aKey, PeriodSelectorName.LastPeriodAgregatPredecesorSelector));
		listOrderedOperAttributDescPeriodSelector2.addKeyAttribut(aOperXKey);
		listOrderedOperAttributDescPeriodSelector2.addKeyAttribut(aOperYKey);
		operandContextResolver.addCtxForPeriodSelector(PeriodSelectorName.FirstChildPeriodSelector.value(), listOrderedOperAttributDescPeriodSelector2);		
	}
 
	private void configCalculWithGrossMarginFormula(final String aKey, final String aOperKey) throws PCCACalculatorException {
		final String METH = ".configCalculWithGrossMarginFormula(): ";
		// Configuration de calcul Attribut avec formule GrossMargin		
		FormulaContextResolver formulaContextResolver = new FormulaContextResolver(aKey);
		mapFormulaContextResolver.put(aKey, formulaContextResolver);
		OperandContextResolver operandContextResolver = new OperandContextResolver(aKey);
		mapOperandContextResolver.put(aKey, operandContextResolver);
 
		// Configuration de l'algorithme par defaut : GrossMarginFormula, avec le parametre (Initial Gross Margin)
		FormulaDescriptor formulaDescriptorDefault = new FormulaDescriptor(FormulaName.GrossMargin.value(), ParamName.InitialGrossMargin.value()); 
		log.debug(METH+"formulaDescriptorDefault:"+((formulaDescriptorDefault==null)?"null":formulaDescriptorDefault.toString()));
		FormulaCtxDescriptor formulaCtxDescriptorDefault = new FormulaCtxDescriptor(formulaDescriptorDefault);
		formulaContextResolver.setCtxDefault(formulaCtxDescriptorDefault);
		// Configuration de l'operande associee a l'algorithme par defaut : attribut operande : aOperKey 
		ListOrderedOperAttributDesc listOrderedOperAttributDescDefault = new ListOrderedOperAttributDesc();
		listOrderedOperAttributDescDefault.addKeyAttribut(aOperKey);
		operandContextResolver.setCtxDefault(listOrderedOperAttributDescDefault);
	}	
 
	private void configCalculWithSumFormula(final String aKey, final String aOperXKey, final String aOperYKey) throws PCCACalculatorException {
		final String METH = ".configCalculWithSumFormula(): ";	
		// Configuration de calcul Attribut avec formule Sum		
		FormulaContextResolver formulaContextResolver = new FormulaContextResolver(aKey);
		mapFormulaContextResolver.put(aKey, formulaContextResolver);
		OperandContextResolver operandContextResolver = new OperandContextResolver(aKey);
		mapOperandContextResolver.put(aKey, operandContextResolver);
 
		// Configuration de l'algorithme par defaut : SumFormula
		FormulaDescriptor formulaDescriptorDefault = new FormulaDescriptor(FormulaName.Sum.value()); 
		log.debug(METH+"formulaDescriptorDefault:"+((formulaDescriptorDefault==null)?"null":formulaDescriptorDefault.toString()));
		FormulaCtxDescriptor formulaCtxDescriptorDefault = new FormulaCtxDescriptor(formulaDescriptorDefault);
		formulaContextResolver.setCtxDefault(formulaCtxDescriptorDefault);
		// Configuration des operandes associees a l'algorithme par defaut : attributs operandes : aOperXKey, aOperYKey  
		ListOrderedOperAttributDesc listOrderedOperAttributDescDefault = new ListOrderedOperAttributDesc();
		listOrderedOperAttributDescDefault.addKeyAttribut(aOperXKey);
		listOrderedOperAttributDescDefault.addKeyAttribut(aOperYKey);
		operandContextResolver.setCtxDefault(listOrderedOperAttributDescDefault);		
	}
 
	private void configCalculWithApplicatorCumulationIdemFormula(final String aKey, final String aOperXKey) throws PCCACalculatorException, PCCAException {
		final String METH = ".configCalculWithApplicatorCumulationIdemFormula(): ";
		// Configuration de calcul Attribut avec formule applicateur Cumulation et formule Idem
		FormulaContextResolver formulaContextResolver = new FormulaContextResolver(aKey);
		mapFormulaContextResolver.put(aKey, formulaContextResolver);
		OperandContextResolver operandContextResolver = new OperandContextResolver(aKey);
		mapOperandContextResolver.put(aKey, operandContextResolver);
 
		// Configuration de l'algorithme par defaut : Idem		
		FormulaDescriptor formulaDescriptorDefault = new FormulaDescriptor(FormulaName.Idem.value()); 
		log.debug(METH+"formulaDescriptorDefault:"+((formulaDescriptorDefault==null)?"null":formulaDescriptorDefault.toString()));
		ExpressionFormApplicatorDescriptor formApplicatorDescriptor = new ExpressionFormApplicatorDescriptor(FormulaApplicatorName.ExpressionCumulation.value()); 
		log.debug(METH+"formApplicatorDescriptor:"+((formApplicatorDescriptor==null)?"null":formApplicatorDescriptor.toString()));
		FormulaCtxDescriptor formulaCtxDescriptorDefault = new FormulaCtxDescriptor(formulaDescriptorDefault, formApplicatorDescriptor);
		formulaContextResolver.setCtxDefault(formulaCtxDescriptorDefault);
		// Configuration des operandes associees a l'algorithme par defaut : attribut operande : WR (Weighted Revenue) ou WCV (Weighted Cost Variance on GM)  
		ListOrderedOperAttributDesc listOrderedOperAttributDescDefault = new ListOrderedOperAttributDesc();
		listOrderedOperAttributDescDefault.addKeyAttribut(aOperXKey);
		operandContextResolver.setCtxDefault(listOrderedOperAttributDescDefault);
 
		// Configuration de l'algorithme explicite pour les periodes type Agregat, selectionnees par Selecteur AgregatPeriodSelector : IdemFormula
		FormulaDescriptor formulaDescriptorPeriodSelector = new FormulaDescriptor(FormulaName.Idem.value());
		log.debug(METH+"formulaDescriptorPeriodSelector:"+((formulaDescriptorPeriodSelector==null)?"null":formulaDescriptorPeriodSelector.toString()));
		FormulaCtxDescriptor formulaCtxDescriptorPeriodSelector = new FormulaCtxDescriptor(formulaDescriptorPeriodSelector);
		formulaContextResolver.addCtxForPeriodSelector(PeriodSelectorName.AgregatPeriodSelector.value(), formulaCtxDescriptorPeriodSelector);
		// Configuration des operandes associees a l'algorithme explicite pour les periodes type Agregat : attribut operande : (attribut courant) 
		ListOrderedOperAttributDesc listOrderedOperAttributDescPeriodSelector1 = new ListOrderedOperAttributDesc();
		listOrderedOperAttributDescPeriodSelector1.addOperAttribValuesDescriptor(new OperAttribValuesDescriptor(aKey, PeriodSelectorName.LastChildPeriodWithSameParentSelector));
		operandContextResolver.addCtxForPeriodSelector(PeriodSelectorName.AgregatPeriodSelector.value(), listOrderedOperAttributDescPeriodSelector1);
 
		// Configuration des operandes explicites associees a l'algorithme par defaut pour les periodes selectionnees par le Selecteur FirstChildPeriodSelector:
		// attributs operandes :  (attribut courant), WR (Weighted Revenue) ou WCV (Weighted Cost Variance on GM)
		ListOrderedOperAttributDesc listOrderedOperAttributDescPeriodSelector2 = new ListOrderedOperAttributDesc();
		listOrderedOperAttributDescPeriodSelector2.addOperAttribValuesDescriptor(new OperAttribValuesDescriptor(aKey, PeriodSelectorName.LastPeriodAgregatPredecesorSelector));
		listOrderedOperAttributDescPeriodSelector2.addKeyAttribut(aOperXKey);
		operandContextResolver.addCtxForPeriodSelector(PeriodSelectorName.FirstChildPeriodSelector.value(), listOrderedOperAttributDescPeriodSelector2);		
	}	
 
	private void configCalculWithPercentAdjustedGrossMarginFormula(final String aKey, final String aOperXKey, final String aOperYKey) throws PCCACalculatorException, PCCAException {
		final String METH = ".configCalculWithPercentAdjustedGrossMarginFormula(): ";
		// Configuration de calcul Attribut avec formule PercentAdjustedGrossMargin
		FormulaContextResolver formulaContextResolver = new FormulaContextResolver(aKey);
		mapFormulaContextResolver.put(aKey, formulaContextResolver);
		OperandContextResolver operandContextResolver = new OperandContextResolver(aKey);
		mapOperandContextResolver.put(aKey, operandContextResolver);
 
		// Configuration de l'algorithme par defaut : PercentAdjustedGrossMargin	
		FormulaDescriptor formulaDescriptorDefault = new FormulaDescriptor(FormulaName.PercentAdjustedGrossMargin.value(), ParamName.InitialGrossMargin.value()); 
		log.debug(METH+"formulaDescriptorDefault:"+((formulaDescriptorDefault==null)?"null":formulaDescriptorDefault.toString()));
		FormulaCtxDescriptor formulaCtxDescriptorDefault = new FormulaCtxDescriptor(formulaDescriptorDefault);
		formulaContextResolver.setCtxDefault(formulaCtxDescriptorDefault);
		// Configuration des operandes associees a l'algorithme par defaut : attributs operandes : isWCV (Weighted Cost Variance on GM), isWR (Weighted Revenue) 
		ListOrderedOperAttributDesc listOrderedOperAttributDescDefault = new ListOrderedOperAttributDesc();
		listOrderedOperAttributDescDefault.addKeyAttribut(aOperXKey);
		listOrderedOperAttributDescDefault.addKeyAttribut(aOperYKey);
		operandContextResolver.setCtxDefault(listOrderedOperAttributDescDefault);
 
		// Configuration de l'algorithme explicite pour les periodes type Agregat, selectionnees par Selecteur AgregatPeriodSelector : IdemFormula
		FormulaDescriptor formulaDescriptorPeriodSelector = new FormulaDescriptor(FormulaName.Idem.value());
		log.debug(METH+"formulaDescriptorPeriodSelector:"+((formulaDescriptorPeriodSelector==null)?"null":formulaDescriptorPeriodSelector.toString()));
		FormulaCtxDescriptor formulaCtxDescriptorPeriodSelector = new FormulaCtxDescriptor(formulaDescriptorPeriodSelector);
		formulaContextResolver.addCtxForPeriodSelector(PeriodSelectorName.AgregatPeriodSelector.value(), formulaCtxDescriptorPeriodSelector);
		// Configuration des operandes associees a l'algorithme explicite pour les periodes type Agregat : attribut operande : (attribut courant) 
		ListOrderedOperAttributDesc listOrderedOperAttributDescPeriodSelector1 = new ListOrderedOperAttributDesc();
		listOrderedOperAttributDescPeriodSelector1.addOperAttribValuesDescriptor(new OperAttribValuesDescriptor(aKey, PeriodSelectorName.LastChildPeriodWithSameParentSelector));
		operandContextResolver.addCtxForPeriodSelector(PeriodSelectorName.AgregatPeriodSelector.value(), listOrderedOperAttributDescPeriodSelector1);	
	}
J'ai mis mon code en entier j'espere que tu comprendra mieux . Quand je parle de value c'est parce que une Hashmap c'est une cle et une valeur....
ladyingold est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 09/02/2012, 12h08   #7
Expert Confirmé Sénior
 
Inscription : septembre 2004
Messages : 5 099
Détails du profil
Informations forums :
Inscription : septembre 2004
Messages : 5 099
Points : 7 025
Points : 7 025
Citation:
Envoyé par ladyingold Voir le message
Comment libère t'on une map sil te plait?
La JavaDoc de Map est assez claire.
Pour enlever des entrées, c'est les méthodes remove() ou keySet().removeAll()/retainAll().
Pour enlever toutes les entrées, c'est la méthode clear().
thelvin est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 09/02/2012, 12h28   #8
Invité de passage
 
Femme
Étudiant
Inscription : février 2012
Messages : 9
Détails du profil
Informations personnelles :
Sexe : Femme
Localisation : France, Val de Marne (Île de France)

Informations professionnelles :
Activité : Étudiant
Secteur : High Tech - Matériel informatique

Informations forums :
Inscription : février 2012
Messages : 9
Points : 0
Points : 0
MErci de ces precisions thelvin... En parcourant mon code tu penses que c'estd e la que viendrait le problème?
ladyingold est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 09/02/2012, 14h50   #9
Expert Confirmé Sénior
 
Inscription : septembre 2004
Messages : 5 099
Détails du profil
Informations forums :
Inscription : septembre 2004
Messages : 5 099
Points : 7 025
Points : 7 025
Citation:
Envoyé par ladyingold Voir le message
MErci de ces precisions thelvin... En parcourant mon code tu penses que c'estd e la que viendrait le problème?
Je n'en sais rien. Je ne sais pas s'il y a un problème, et s'il y en a un je ne sais pas ce qu'il est ni où il est.
Il y a trop de code, si tu veux que je fasse un audit dessus, arrange-toi avec mon commercial pour m'embaucher. Et il faudra alors me montrer absolument tout ce que vous avez, comment vous vous en servez, comment le lancer avec quels outils, etc. Pas juste ce petit bout de code.
thelvin est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 09/02/2012, 14h59   #10
Invité de passage
 
Femme
Étudiant
Inscription : février 2012
Messages : 9
Détails du profil
Informations personnelles :
Sexe : Femme
Localisation : France, Val de Marne (Île de France)

Informations professionnelles :
Activité : Étudiant
Secteur : High Tech - Matériel informatique

Informations forums :
Inscription : février 2012
Messages : 9
Points : 0
Points : 0
Citation:
Envoyé par thelvin Voir le message
si tu veux que je fasse un audit dessus, arrange-toi avec mon commercial pour m'embaucher. Et il faudra alors me montrer absolument tout ce que vous avez, comment vous vous en servez, comment le lancer avec quels outils, etc. Pas juste ce petit bout de code.
Lool!!
Bon bah j ai pas les moyens de me payer une audit mais bon j’espère que d'autres personnes pourraient m'aider
ladyingold est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 09/02/2012, 15h05   #11
Expert Confirmé Sénior
 
Inscription : septembre 2004
Messages : 5 099
Détails du profil
Informations forums :
Inscription : septembre 2004
Messages : 5 099
Points : 7 025
Points : 7 025
Citation:
Envoyé par ladyingold Voir le message
Bon bah j ai pas les moyens de me payer une audit mais bon j’espère que d'autres personnes pourraient m'aider
Pas complètement impossible, mais franchement ça m'étonnerait.
Je n'ai que survolé ce truc, alors je ne suis pas sûr. Mais il est probable qu'il ne fasse rien de mal avec l'utilisation mémoire. Autrement dit, que le problème ce soit pas ce bout de code, mais comment tu t'en sers.
thelvin est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 09/02/2012, 15h21   #12
Modérateur
 
Avatar de tchize_
 
Homme
Responsable de service informatique
Inscription : avril 2007
Messages : 16 199
Détails du profil
Informations personnelles :
Sexe : Homme
Âge : 32
Localisation : Belgique

Informations professionnelles :
Activité : Responsable de service informatique
Secteur : Service public

Informations forums :
Inscription : avril 2007
Messages : 16 199
Points : 25 348
Points : 25 348
Envoyer un message via MSN à tchize_ Envoyer un message via Skype™ à tchize_
Si j'ai bien compris, ton analyzeur te pointe la hashmap (laquelle?) comme coupable de posséder "beaucoup" de données. A partir de là il faut commencer à utiliser cet analyzeur pour analyzer ta heap. La première question à se poser: "combien d'entrées dans la hashmap?" : une dixaine? La map n'est pas directement coupable. Plusieurs millions? La map retient trop de trucs.

si la map n'est pas coupable, il faut prendre un des objest dedans et regarder ce que lui garde, etc. Et descendre jusqu'à trouver. Ca peux prendre du temps. La dernière fois que j'ai fait ce genre de chose pour trouver un memory leak, ça m'a pris un journée pour analyser la heap et comprendre ce qui se passait. Mais ça restait mieux que de passer 3 semaines à coup de println pour essayer de comprendre ce qui se passait
__________________
⥀⥁ Чиз faq java, cours java, javadoc. Pensez à et
"Votre génitrice tute des pédoncules au pandémonium" (le conjurateur, 1973)
tchize_ est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 09/02/2012, 16h51   #13
Invité de passage
 
Femme
Étudiant
Inscription : février 2012
Messages : 9
Détails du profil
Informations personnelles :
Sexe : Femme
Localisation : France, Val de Marne (Île de France)

Informations professionnelles :
Activité : Étudiant
Secteur : High Tech - Matériel informatique

Informations forums :
Inscription : février 2012
Messages : 9
Points : 0
Points : 0
puisque il s'agit d'une application de gestion de projets, la map se rempli en fonction du nombre de projet selectionnée; Lorsque c'est 10 projet la fuite ne se manifeste mas , mais lorsque l'on selectionne 250 projets la on a tout suite une utilisation de 70% de la memoire par la classe "java.util.HashMap$Entry[]".
L'analyse de la heap se fait via Eclipse Memory tool?
ladyingold est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 09/02/2012, 20h02   #14
Modérateur
 
Avatar de tchize_
 
Homme
Responsable de service informatique
Inscription : avril 2007
Messages : 16 199
Détails du profil
Informations personnelles :
Sexe : Homme
Âge : 32
Localisation : Belgique

Informations professionnelles :
Activité : Responsable de service informatique
Secteur : Service public

Informations forums :
Inscription : avril 2007
Messages : 16 199
Points : 25 348
Points : 25 348
Envoyer un message via MSN à tchize_ Envoyer un message via Skype™ à tchize_
70% de combien de mémoire? Ce résultat démontre donc (si t'as 250 éléments dans la map) que ce sont tes objet Projet qui sont gourmands
__________________
⥀⥁ Чиз faq java, cours java, javadoc. Pensez à et
"Votre génitrice tute des pédoncules au pandémonium" (le conjurateur, 1973)
tchize_ est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 10/02/2012, 12h04   #15
Invité de passage
 
Femme
Étudiant
Inscription : février 2012
Messages : 9
Détails du profil
Informations personnelles :
Sexe : Femme
Localisation : France, Val de Marne (Île de France)

Informations professionnelles :
Activité : Étudiant
Secteur : High Tech - Matériel informatique

Informations forums :
Inscription : février 2012
Messages : 9
Points : 0
Points : 0
oui je pense que les projets prennent beaucoup de place quand on en selectionne beaucoup. mais y'a t il pas une facon de ne pas les accumuler en memoire?? j'ai ceci comme resultat apres analyse de Memory analyer tool
Images attachées
Type de fichier : jpg mat.jpg (77,9 Ko, 6 affichages)
ladyingold est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 10/02/2012, 14h35   #16
Rédacteur/Modérateur
 
Avatar de adiGuba
 
Homme
Développeur Java/Web
Inscription : avril 2002
Messages : 12 460
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France, Corse (Corse)

Informations professionnelles :
Activité : Développeur Java/Web
Secteur : Transports

Informations forums :
Inscription : avril 2002
Messages : 12 460
Points : 19 447
Points : 19 447
alut,

Citation:
Envoyé par ladyingold Voir le message
mais y'a t il pas une facon de ne pas les accumuler en memoire??
Oui : il suffit de ne pas les stocker en mémoire !


C'est sur que si tu stockes tout en mémoire et que tu charges plein de données tu va consommer plein de mémoire...


De plus le fait que tu utilises un singleton avec des Map en static n'aide pas du tout : tout est stocké au même endroit pour tous tes projets.


Il faudrait peut être revoir ton modèle de données...


a++
__________________
adiGuba [ tutoriels | blog | twitter ] Rédacteur/Modérateur Java Présentation de Java SE 7 (commentaires)
adiGuba est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 10/02/2012, 14h47   #17
Invité de passage
 
Femme
Étudiant
Inscription : février 2012
Messages : 9
Détails du profil
Informations personnelles :
Sexe : Femme
Localisation : France, Val de Marne (Île de France)

Informations professionnelles :
Activité : Étudiant
Secteur : High Tech - Matériel informatique

Informations forums :
Inscription : février 2012
Messages : 9
Points : 0
Points : 0
Merci!
mais tu peux sil te plait etayer ces phrases pour moi:
" un singleton avec des Map en static" et "Il faudrait peut être revoir ton modèle de données..."
Merci d'avance
ladyingold est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 10/02/2012, 14h55   #18
Membre chevronné
 
Inscription : février 2010
Messages : 580
Détails du profil
Informations personnelles :
Localisation : France

Informations professionnelles :
Secteur : Finance

Informations forums :
Inscription : février 2010
Messages : 580
Points : 727
Points : 727
Bonjour,

Moi je trouve que ta structure Map et Liste de Map n'est pas du tout adapté.
Surtout pour faire un keySet() dessus et parcourir tout dans une boucle for.

Une HashMap c'est pour faire des accès directe à une valeur en particulier, ça sert à rien pour lire en séquence.

Ta structure en fait c'est un tableau à 2 dimension de float.
Jimmy_ est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 10/02/2012, 15h26   #19
Rédacteur/Modérateur
 
Avatar de adiGuba
 
Homme
Développeur Java/Web
Inscription : avril 2002
Messages : 12 460
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France, Corse (Corse)

Informations professionnelles :
Activité : Développeur Java/Web
Secteur : Transports

Informations forums :
Inscription : avril 2002
Messages : 12 460
Points : 19 447
Points : 19 447
Citation:
Envoyé par ladyingold Voir le message
mais tu peux sil te plait etayer ces phrases pour moi:
Pour étayer il faudrait connaitre ton projet...


Quel est l'objectif de ton application ?
Pourquoi utilises-tu un singleton ?
Pourquoi utilises-tu des Map static ?


a++
__________________
adiGuba [ tutoriels | blog | twitter ] Rédacteur/Modérateur Java Présentation de Java SE 7 (commentaires)
adiGuba est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 10/02/2012, 15h51   #20
Invité de passage
 
Femme
Étudiant
Inscription : février 2012
Messages : 9
Détails du profil
Informations personnelles :
Sexe : Femme
Localisation : France, Val de Marne (Île de France)

Informations professionnelles :
Activité : Étudiant
Secteur : High Tech - Matériel informatique

Informations forums :
Inscription : février 2012
Messages : 9
Points : 0
Points : 0
"Quel est l'objectif de ton application ?" ==> Mon application permet de financièrement les projets en cours d'un département à travers plusieurs attributs comme "OI", "R"... que vous pouvez vois dans le code lorsque l'on veut les calculer.

"Pourquoi utilises-tu un singleton ?
Pourquoi utilises-tu des Map static ?" ==> Je suis arriver sur le projet y'a deux semaines donc c'est pas moi qui ai écrit ce code raison pour laquelle je m arrache les cheveux dessus et que je ne comprend pas tout ce qui a été fait (le mec étant partit sans laisser de trace). Le chef de projet ayant remarque des perditions de mémoire à l’exécution de l'application il m'a demander de m'en occuper et de modifier le code s'il le fallait pour enlever ces fuites mémoires. Mais avant de le modifier il faut le comprendre ce qui n'est pas trop mon cas d'ou ma demande d'aide...
Je pense que les map c'est pour stocker les projets sélectionner , maintenant pourquoi l'avoir déclarer en static je sais pas.
ladyingold est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 21h13.


 
 
 
 
Partenaires

Hébergement Web