01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.admin.dso;
05:
06: import com.tc.objectserver.api.GCStats;
07:
08: import com.tc.admin.AdminClient;
09: import com.tc.admin.common.XObjectTableModel;
10:
11: public class GCStatsTableModel extends XObjectTableModel {
12: private static final String[] FIELDS = { "Iteration", "StartDate",
13: "ElapsedTime", "BeginObjectCount", "CandidateGarbageCount",
14: "ActualGarbageCount" };
15:
16: private static final String[] HEADERS = AdminClient.getContext()
17: .getMessages(
18: new String[] { "dso.gcstats.iteration",
19: "dso.gcstats.startTime",
20: "dso.gcstats.elapsedTime",
21: "dso.gcstats.beginObjectCount",
22: "dso.gcstats.candidateGarbageCount",
23: "dso.gcstats.actualGarbageCount" });
24:
25: public GCStatsTableModel() {
26: super (GCStatsWrapper.class, FIELDS, HEADERS);
27: }
28:
29: public void setGCStats(GCStats[] gcStats) {
30: int count = gcStats != null ? gcStats.length : 0;
31: GCStatsWrapper[] wrappers = new GCStatsWrapper[count];
32:
33: for (int i = 0; i < count; i++) {
34: wrappers[i] = new GCStatsWrapper(gcStats[i]);
35: }
36:
37: set(wrappers);
38: }
39:
40: public void addGCStats(GCStats gcStats) {
41: add(0, new GCStatsWrapper(gcStats));
42: fireTableRowsInserted(0, 0);
43: }
44: }
|