Public Member Functions | |
MonitoringGraph (AbstractDataCollector collector, DataCollectorMBean jmxClient) | |
void | display () |
void | addData (long newValue) |
void | saveAs () throws IOException |
void | run () |
AbstractDataCollector | getCollector () |
void | setCollector (AbstractDataCollector collector) |
JFrame | getFrame () |
void | setFrame (JFrame frame) |
boolean | getFramed () |
void | setFramed (boolean framed) |
long | getFrequency () |
void | setFrequency (long frequency) |
long | getRepeat () |
void | setRepeat (long repeat) |
boolean | getStop () |
void | setStop (boolean stop) |
int | getTimeFrame () |
void | setTimeFrame (int timeFrame) |
JFreeChart | getChart () |
ChartPanel | getPanel () |
long | getTimeStarted () |
boolean | getDisplay () |
void | setDisplay (boolean display) |
int | getFrameHeight () |
void | setFrameHeight (int frameHeight) |
int | getFrameWidth () |
void | setFrameWidth (int frameWidth) |
boolean | getSaveOnFinish () |
void | setSaveOnFinish (boolean saveOnFinish) |
String | getText () |
void | setText (String text) |
long | getPoolingSpeed () |
void | setPoolingSpeed (long poolingSpeed) |
long | getDisplayFrequency () |
void | setDisplayFrequency (long displayFrequency) |
MonitoringGraph
also contains the thread that retrieves the information at the moment. TODO: Should take out this Thread
so that it connects to a monitoring repository.
Definition at line 54 of file MonitoringGraph.java.
|
Creates a new
Definition at line 94 of file MonitoringGraph.java. References org.objectweb.cjdbc.console.monitoring.MonitoringGraph.display(). 00096 { 00097 this.collector = collector; 00098 this.jmxClient = jmxClient; 00099 00100 buffer = new XYSeries("Buffer"); 00101 00102 series = new XYSeries(collector.getTargetName()); 00103 series.setMaximumItemCount(timeFrame); 00104 dataset = new XYSeriesCollection(series); 00105 chart = ChartFactory.createXYLineChart(collector.getDescription(), 00106 "Time (Started at:" 00107 + new SimpleDateFormat("HH:mm:ss").format(new Date()) + ")", "", 00108 dataset, PlotOrientation.VERTICAL, true, false, false); 00109 panel = new ChartPanel(chart); 00110 panel.setSize(frameWidth, frameHeight); 00111 00112 if (display) 00113 display(); 00114 }
|
|
Add a data entry to the current serie. Bufferize given the buffer series size
Definition at line 140 of file MonitoringGraph.java. Referenced by org.objectweb.cjdbc.console.monitoring.MonitoringGraph.run(). 00141 { 00142 long now = (System.currentTimeMillis() / 1000) - timeStarted; 00143 if (displayFrequency == 0) 00144 { 00145 series.add(now, newValue); 00146 } 00147 else if (displayFrequencyCount < displayFrequency) 00148 { 00149 displayFrequencyCount++; 00150 buffer.add(now, newValue); 00151 } 00152 else 00153 { 00154 int count = buffer.getItemCount(); 00155 for (int i = 0; i < count; i++) 00156 { 00157 series.add(buffer.getDataItem(i)); 00158 } 00159 buffer = new XYSeries("buffer"); 00160 displayFrequencyCount = 0; 00161 } 00162 }
|
|
Display the graph on screen Definition at line 119 of file MonitoringGraph.java. Referenced by org.objectweb.cjdbc.console.monitoring.MonitoringGraph.MonitoringGraph(). 00120 { 00121 chart.setBorderVisible(false); 00122 panel.setVisible(true); 00123 if (framed) 00124 { 00125 frame = new JFrame(collector.getDescription()); 00126 frame.getContentPane().add(panel); 00127 frame.setSize(new java.awt.Dimension(frameWidth, frameHeight)); 00128 RefineryUtilities.centerFrameOnScreen(frame); 00129 frame.setVisible(true); 00130 frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); 00131 } 00132 }
|
|
Definition at line 339 of file MonitoringGraph.java. 00340 {
00341 return chart;
00342 }
|
|
Definition at line 226 of file MonitoringGraph.java. 00227 {
00228 return collector;
00229 }
|
|
Definition at line 363 of file MonitoringGraph.java. 00364 {
00365 return display;
00366 }
|
|
Definition at line 459 of file MonitoringGraph.java. 00460 {
00461 return displayFrequency;
00462 }
|
|
Definition at line 242 of file MonitoringGraph.java. Referenced by org.objectweb.cjdbc.console.monitoring.MonitoringConsole.graph(). 00243 {
00244 return frame;
00245 }
|
|
Definition at line 258 of file MonitoringGraph.java. 00259 {
00260 return framed;
00261 }
|
|
Definition at line 379 of file MonitoringGraph.java. 00380 {
00381 return frameHeight;
00382 }
|
|
Definition at line 395 of file MonitoringGraph.java. 00396 {
00397 return frameWidth;
00398 }
|
|
Definition at line 274 of file MonitoringGraph.java. 00275 {
00276 return frequency;
00277 }
|
|
Definition at line 347 of file MonitoringGraph.java. 00348 {
00349 return panel;
00350 }
|
|
Definition at line 443 of file MonitoringGraph.java. 00444 {
00445 return poolingSpeed;
00446 }
|
|
Definition at line 290 of file MonitoringGraph.java. 00291 {
00292 return repeat;
00293 }
|
|
Definition at line 411 of file MonitoringGraph.java. 00412 {
00413 return saveOnFinish;
00414 }
|
|
Definition at line 306 of file MonitoringGraph.java. 00307 {
00308 return stop;
00309 }
|
|
Definition at line 427 of file MonitoringGraph.java. 00428 {
00429 return text;
00430 }
|
|
Definition at line 322 of file MonitoringGraph.java. 00323 {
00324 return timeFrame;
00325 }
|
|
Definition at line 355 of file MonitoringGraph.java. 00356 {
00357 return timeStarted;
00358 }
|
|
Definition at line 180 of file MonitoringGraph.java. References org.objectweb.cjdbc.console.monitoring.MonitoringGraph.addData(), and org.objectweb.cjdbc.console.monitoring.MonitoringGraph.saveAs(). 00181 { 00182 timeStarted = System.currentTimeMillis() / 1000; 00183 int count = 0; 00184 while (repeat == -1 || count < repeat) 00185 { 00186 count++; 00187 synchronized (this) 00188 { 00189 try 00190 { 00191 addData(jmxClient.retrieveData(collector)); 00192 wait(frequency); 00193 if (stop) 00194 break; 00195 00196 if (display == true && panel.isShowing() == false) 00197 { 00198 if (panel.getParent().isShowing() == false) 00199 stop = true; 00200 } 00201 00202 } 00203 catch (Exception e) 00204 { 00205 stop = true; 00206 throw new RuntimeException(e.getMessage()); 00207 } 00208 } 00209 } 00210 if (saveOnFinish) 00211 { 00212 try 00213 { 00214 saveAs(); 00215 } 00216 catch (Exception e) 00217 { 00218 //ignore 00219 } 00220 } 00221 }
|
|
Save the graph into a file
Definition at line 169 of file MonitoringGraph.java. Referenced by org.objectweb.cjdbc.console.monitoring.MonitoringGraph.run(). 00170 { 00171 String fileName = collector.getTargetName() + "-" 00172 + new SimpleDateFormat().format(new Date()); 00173 ChartUtilities.saveChartAsJPEG(new File(fileName), this.chart, frameWidth, 00174 frameHeight); 00175 }
|
|
Definition at line 234 of file MonitoringGraph.java. 00235 {
00236 this.collector = collector;
00237 }
|
|
Definition at line 371 of file MonitoringGraph.java. 00372 {
00373 this.display = display;
00374 }
|
|
Definition at line 467 of file MonitoringGraph.java. Referenced by org.objectweb.cjdbc.console.monitoring.MonitoringConsole.graph(). 00468 {
00469 this.displayFrequency = displayFrequency;
00470 }
|
|
Definition at line 250 of file MonitoringGraph.java. 00251 {
00252 this.frame = frame;
00253 }
|
|
Definition at line 266 of file MonitoringGraph.java. 00267 {
00268 this.framed = framed;
00269 }
|
|
Definition at line 387 of file MonitoringGraph.java. 00388 {
00389 this.frameHeight = frameHeight;
00390 }
|
|
Definition at line 403 of file MonitoringGraph.java. 00404 {
00405 this.frameWidth = frameWidth;
00406 }
|
|
Definition at line 282 of file MonitoringGraph.java. Referenced by org.objectweb.cjdbc.console.monitoring.MonitoringConsole.graph(). 00283 {
00284 this.frequency = frequency;
00285 }
|
|
Definition at line 451 of file MonitoringGraph.java. 00452 {
00453 this.poolingSpeed = poolingSpeed;
00454 }
|
|
Definition at line 298 of file MonitoringGraph.java. Referenced by org.objectweb.cjdbc.console.monitoring.MonitoringConsole.graph(). 00299 {
00300 this.repeat = repeat;
00301 }
|
|
Definition at line 419 of file MonitoringGraph.java. 00420 {
00421 this.saveOnFinish = saveOnFinish;
00422 }
|
|
Definition at line 314 of file MonitoringGraph.java. 00315 {
00316 this.stop = stop;
00317 }
|
|
Definition at line 435 of file MonitoringGraph.java. Referenced by org.objectweb.cjdbc.console.monitoring.MonitoringConsole.graph(). 00436 {
00437 this.text = text;
00438 }
|
|
Definition at line 330 of file MonitoringGraph.java. Referenced by org.objectweb.cjdbc.console.monitoring.MonitoringConsole.graph(). 00331 {
00332 this.timeFrame = timeFrame;
00333 series.setMaximumItemCount(timeFrame);
00334 }
|