High memory usage by agent
Bonjour à tous,
J'ai le message de Warning suivant sur la console :
@@@ Agent memory usage (9) percentage of total
High memory usageby agent 'monagent' in database 'mabase.nsf'. Threshold level high.
Mon agent parcours une vue puis construit du code html pour faire un planning. Plus j'ai de lignes dans le planning, plus le pouircentage de mémoire est elevé.
Avez-vous déjà eu ce genre de message ? Voila la classe java de mon agent
Est-ce que vous voyez quelque chose qui pourrait prendre beucoup de ressources svp ?
Merci.
J'ai le message de Warning suivant sur la console :
@@@ Agent memory usage (9) percentage of total
High memory usageby agent 'monagent' in database 'mabase.nsf'. Threshold level high.
Mon agent parcours une vue puis construit du code html pour faire un planning. Plus j'ai de lignes dans le planning, plus le pouircentage de mémoire est elevé.
Avez-vous déjà eu ce genre de message ? Voila la classe java de mon agent
Est-ce que vous voyez quelque chose qui pourrait prendre beucoup de ressources svp ?
- Code : Tout sélectionner
public class PlanningBuild extends AbstractDominoAgent {
private Document context;
public static final String FIELD_OFFICE = "office";
public static final String FIELD_MONTH = "month";
public static final String FIELD_YEAR = "year";
public PlanningBuild(final Session session, final Document context) {
super(session);
this.context = context;
}
public void run() throws NotesException {
try{
Database db = context.getParentDatabase();
try {
String month = context.getItemValueString(FIELD_MONTH);
String year = context.getItemValueString(FIELD_YEAR);
String office = context.getItemValueString(FIELD_OFFICE);
int m = Integer.parseInt(month) - 1 ;
int y = Integer.parseInt(year);
String vwName = "($Planning)";
View view = db.getView(vwName);
try {
if (null == view) {
throw new NotesException(NotesError.NOTES_ERR_VIEW_MISSING, "view " + vwName + " not found");
}
GregorianCalendar gc = new GregorianCalendar();
HolidayFactory factory = new HolidayFactory(db, office, year);
Vector holidays = new Vector();
holidays = factory.getHolidaysCountry();
Collections.sort(holidays);
Vector holidaysMonth = new Vector();
for (int i = 0; i < holidays.size(); i++) {
Date d = (Date) holidays.elementAt(i);
gc.setTime(d);
if (gc.get(Calendar.MONTH) == m) {
Integer day = new Integer(gc.get(Calendar.DAY_OF_MONTH));
holidaysMonth.addElement(day);
}
}
Planning planning = new Planning(y,m, holidaysMonth, db.getFileName());
String index = office + "/" + year + "/" + month;
ViewEntryCollection vec = view.getAllEntriesByKey(index,true);
try {
ViewEntry entry = vec.getFirstEntry();
try {
while (entry != null) {
ViewEntry nextEntry = vec.getNextEntry(entry);
Vector line = new Vector();
line = entry.getColumnValues();
String name = String.valueOf(line.elementAt(1));
PlanningPerson person;
if (!planning.personExist(name)) {
person = new PlanningPerson(planning.getYear(), planning.getMonth(), name, holidaysMonth, db.getFileName());
planning.addPerson(person);
} else {
person = planning.searchPlanningPerson(name);
}
if (Integer.parseInt(String.valueOf(line.elementAt(7))) == 1) {
if (String.valueOf(line.elementAt(4)).equalsIgnoreCase(planning.getSMonth())) {
String d = String.valueOf(line.elementAt(3));
if (!person.dayExist(d)) {
person.addDay(d);
person.addDuration(String.valueOf(line.elementAt(6)));
person.addType(String.valueOf(line.elementAt(8)));
person.addId(String.valueOf(line.elementAt(10)));
}
}
} else {
Vector months = new Vector();
months = (Vector) line.elementAt(4);
Vector days = new Vector();
days = (Vector) line.elementAt(3);
Vector durations = new Vector();
durations = (Vector) line.elementAt(6);
String type = String.valueOf(line.elementAt(8));
String docId = String.valueOf(line.elementAt(10));
for (int i = 0; i < days.size(); i++) {
String currentMonth = String.valueOf(months.elementAt(i));
if (currentMonth.equalsIgnoreCase(planning.getSMonth())) {
String d = String.valueOf(days.elementAt(i));
if (!person.dayExist(d)) {
person.addDay(d);
person.addDuration(String.valueOf(durations.elementAt(i)));
person.addType(type);
person.addId(String.valueOf(docId));
}
}
}
}
entry.recycle();
entry = nextEntry;
}
String html = planning.extractPlanningHTML();
context.replaceItemValue("planning", html);
} finally {
dominoRecycle(entry);
}
} finally {
dominoRecycle(vec);
}
} finally {
dominoRecycle(view);
}
} finally {
dominoRecycle(db);
}
} catch (NotesException e) {
e.printStackTrace();
}
}
}
Merci.