1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package com.xpn.xwiki.store; |
21 |
|
|
22 |
|
import java.io.PrintStream; |
23 |
|
import java.util.ArrayList; |
24 |
|
import java.util.List; |
25 |
|
|
26 |
|
import org.slf4j.Logger; |
27 |
|
import org.slf4j.LoggerFactory; |
28 |
|
|
|
|
| 0% |
Uncovered Elements: 59 (59) |
Complexity: 22 |
Complexity Density: 0.67 |
|
29 |
|
public class XWikiBatcherStats |
30 |
|
{ |
31 |
|
private static final Logger LOGGER = LoggerFactory.getLogger(XWikiBatcherStats.class); |
32 |
|
|
33 |
|
private List sqlList = new ArrayList(); |
34 |
|
|
35 |
|
private List recentSqlList = new ArrayList(); |
36 |
|
|
37 |
|
private boolean resetOnNextSQL = false; |
38 |
|
|
39 |
|
private int preparedSQLCounter = 0; |
40 |
|
|
41 |
|
private int executeBatchCounter = 0; |
42 |
|
|
43 |
|
private int abortBatchCounter = 0; |
44 |
|
|
45 |
|
private int resultSetCounter = 0; |
46 |
|
|
47 |
|
private int addToBatchCounter = 0; |
48 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
49 |
0 |
public void resetStats()... |
50 |
|
{ |
51 |
0 |
this.sqlList = new ArrayList(); |
52 |
0 |
this.preparedSQLCounter = 0; |
53 |
0 |
this.executeBatchCounter = 0; |
54 |
0 |
this.abortBatchCounter = 0; |
55 |
0 |
this.resultSetCounter = 0; |
56 |
0 |
this.addToBatchCounter = 0; |
57 |
|
} |
58 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
59 |
0 |
public List getSqlList()... |
60 |
|
{ |
61 |
0 |
return this.sqlList; |
62 |
|
} |
63 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
64 |
0 |
public List getRecentSqlList()... |
65 |
|
{ |
66 |
0 |
return this.recentSqlList; |
67 |
|
} |
68 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
69 |
0 |
public void resetRecentSqlList()... |
70 |
|
{ |
71 |
0 |
this.recentSqlList = new ArrayList(); |
72 |
|
} |
73 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
74 |
0 |
public void addToSqlList(String sql)... |
75 |
|
{ |
76 |
0 |
if (this.resetOnNextSQL) { |
77 |
0 |
resetRecentSqlList(); |
78 |
0 |
this.resetOnNextSQL = false; |
79 |
|
} |
80 |
0 |
this.recentSqlList.add(sql); |
81 |
0 |
this.sqlList.add(sql); |
82 |
|
} |
83 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
84 |
0 |
public void resetOnNextSQL()... |
85 |
|
{ |
86 |
0 |
this.resetOnNextSQL = true; |
87 |
|
} |
88 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
89 |
0 |
public int getPreparedSQLCounter()... |
90 |
|
{ |
91 |
0 |
return this.preparedSQLCounter; |
92 |
|
} |
93 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
94 |
0 |
public void incrementPreparedSQLCounter()... |
95 |
|
{ |
96 |
0 |
this.preparedSQLCounter++; |
97 |
|
} |
98 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
99 |
0 |
public int getExecuteBatchCounter()... |
100 |
|
{ |
101 |
0 |
return this.executeBatchCounter; |
102 |
|
} |
103 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
104 |
0 |
public void incrementExecuteBatchCounter()... |
105 |
|
{ |
106 |
0 |
this.executeBatchCounter++; |
107 |
|
} |
108 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
109 |
0 |
public int getAbortBatchCounter()... |
110 |
|
{ |
111 |
0 |
return this.abortBatchCounter; |
112 |
|
} |
113 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
114 |
0 |
public void incrementAbortBatchCounter()... |
115 |
|
{ |
116 |
0 |
this.abortBatchCounter++; |
117 |
|
} |
118 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
119 |
0 |
public int getResultSetCounter()... |
120 |
|
{ |
121 |
0 |
return this.resultSetCounter; |
122 |
|
} |
123 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
124 |
0 |
public void incrementResultSetCounter()... |
125 |
|
{ |
126 |
0 |
this.resultSetCounter++; |
127 |
|
} |
128 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
129 |
0 |
public int getAddToBatchCounter()... |
130 |
|
{ |
131 |
0 |
return this.addToBatchCounter; |
132 |
|
} |
133 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
134 |
0 |
public void incrementAddToBatchCounter()... |
135 |
|
{ |
136 |
0 |
this.addToBatchCounter++; |
137 |
|
} |
138 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
139 |
0 |
public void printSQLList(PrintStream out)... |
140 |
|
{ |
141 |
0 |
out.println("SQL: number of queries " + this.sqlList.size()); |
142 |
0 |
for (int i = 0; i < this.sqlList.size(); i++) { |
143 |
0 |
out.println("SQL: " + this.sqlList.get(i)); |
144 |
|
} |
145 |
0 |
out.flush(); |
146 |
|
} |
147 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 3 |
Complexity Density: 0.75 |
|
148 |
0 |
public void logSQLList()... |
149 |
|
{ |
150 |
0 |
if (LOGGER.isDebugEnabled()) { |
151 |
0 |
LOGGER.debug("SQL: number of queries " + this.sqlList.size()); |
152 |
0 |
for (int i = 0; i < this.sqlList.size(); i++) { |
153 |
0 |
LOGGER.debug("SQL: " + this.sqlList.get(i)); |
154 |
|
} |
155 |
|
} |
156 |
|
} |
157 |
|
} |