ConsoleSliceConsumer.java

biz/hammurapi/metrics/ConsoleSliceConsumer.java

Violations

Inspector Message Severity Location
Java Inspector 048 Copyrights information should be present in each file. 1
Java Inspector 059 Synchronize at the block level rather than the method level 2 34:9
Java Inspector 068 Do not use System.out and System.err to output logging messages. Use loggers instead. 2 35:33
Java Inspector 068 Do not use System.out and System.err to output logging messages. Use loggers instead. 2 36:33
Java Inspector 068 Do not use System.out and System.err to output logging messages. Use loggers instead. 2 37:33
Java Inspector 068 Do not use System.out and System.err to output logging messages. Use loggers instead. 2 38:33
Java Inspector 068 Do not use System.out and System.err to output logging messages. Use loggers instead. 2 39:33
Java Inspector 068 Do not use System.out and System.err to output logging messages. Use loggers instead. 2 40:33
Java Inspector 068 Do not use System.out and System.err to output logging messages. Use loggers instead. 2 41:33
Java Inspector 068 Do not use System.out and System.err to output logging messages. Use loggers instead. 2 42:33
Java Inspector 068 Do not use System.out and System.err to output logging messages. Use loggers instead. 2 43:33
Java Inspector 068 Do not use System.out and System.err to output logging messages. Use loggers instead. 2 44:33
Java Inspector 068 Do not use System.out and System.err to output logging messages. Use loggers instead. 2 45:33
Java Inspector 068 Do not use System.out and System.err to output logging messages. Use loggers instead. 2 46:35
Java Inspector 089 Undocumented method 2 34:9
Java Inspector 026 Avoid hardwired string literals. Allowed literals: [] 3 35:34
Java Inspector 026 Avoid hardwired string literals. Allowed literals: [] 3 37:34
Java Inspector 026 Avoid hardwired string literals. Allowed literals: [] 3 38:34
Java Inspector 026 Avoid hardwired string literals. Allowed literals: [] 3 39:34
Java Inspector 026 Avoid hardwired string literals. Allowed literals: [] 3 40:34
Java Inspector 026 Avoid hardwired string literals. Allowed literals: [] 3 41:34
Java Inspector 026 Avoid hardwired string literals. Allowed literals: [] 3 42:34
Java Inspector 026 Avoid hardwired string literals. Allowed literals: [] 3 43:34
Java Inspector 026 Avoid hardwired string literals. Allowed literals: [] 3 44:34
Java Inspector 026 Avoid hardwired string literals. Allowed literals: [] 3 44:60
Java Inspector 026 Avoid hardwired string literals. Allowed literals: [] 3 44:91
Java Inspector 026 Avoid hardwired string literals. Allowed literals: [] 3 45:34
Java Inspector 026 Avoid hardwired string literals. Allowed literals: [] 3 45:56
Java Inspector 026 Avoid hardwired string literals. Allowed literals: [] 3 45:85
Java Inspector 026 Avoid hardwired string literals. Allowed literals: [] 3 46:36

Source code

1/*
2 * hgcommons 9
3 * Hammurapi Group Common Library
4 * Copyright (C) 2003 Hammurapi Group
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 * URL: http://www.hammurapi.biz/hammurapi-biz/ef/xmenu/hammurapi-group/products/products/hgcommons/index.html
21 * e-Mail: support@hammurapi.biz
22 */
23package biz.hammurapi.metrics;
24
25import java.util.Date;
26
27/**
28 * Outputs slices to System.out.
29 * @author Pavel Vlasov
30 * @revision $Revision$
31 */
32public class ConsoleSliceConsumer implements SliceConsumer {
33
34 public synchronized boolean consumeSlice(String category, Slice slice) {
35 System.out.print("SLICE ");
36 System.out.print(category);
37 System.out.print(": ");
38 System.out.print("Name="+slice.getName());
39 System.out.print("; Total="+slice.getTotal());
40 System.out.print("; Avg="+slice.getAvg());
41 System.out.print("; Min="+slice.getMin());
42 System.out.print("; Max="+slice.getMax());
43 System.out.print("; Deviation="+slice.getDeviation());
44 System.out.print("; From="+slice.getFrom()+" ("+new Date(slice.getFrom())+")");
45 System.out.print("; To="+slice.getTo()+" ("+new Date(slice.getTo())+")");
46 System.out.println("; Measurements="+slice.getNumber());
47 return true;
48 }
49
50}
51