1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
package net.admin4j.jdbc.driver; |
15 | |
|
16 | |
import java.util.HashSet; |
17 | |
import java.util.Map; |
18 | |
import java.util.Set; |
19 | |
import java.util.concurrent.ConcurrentHashMap; |
20 | |
|
21 | |
import net.admin4j.entity.ExecutionStack; |
22 | |
import net.admin4j.timer.SummaryDataMeasure; |
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
public class SqlStatementSummaryDataMeasure extends SummaryDataMeasure { |
30 | |
|
31 | |
private static final long serialVersionUID = 2697140795168204384L; |
32 | 36 | private Map<ExecutionStack,ExecutionStack> executionStackSet |
33 | |
= new ConcurrentHashMap<ExecutionStack,ExecutionStack>(); |
34 | |
|
35 | |
public SqlStatementSummaryDataMeasure(long firstObservationTime, ExecutionStack executionStack) { |
36 | 36 | super(firstObservationTime); |
37 | 36 | if (executionStack != null) { |
38 | 36 | executionStackSet.put(executionStack, executionStack); |
39 | |
} |
40 | 36 | } |
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
@Override |
46 | |
public synchronized void addNumber(Number number) { |
47 | 0 | this.addNumber(number, null); |
48 | 0 | } |
49 | |
|
50 | |
public synchronized void addNumber(Number number, ExecutionStack executionStack) { |
51 | 180138 | super.addNumber(number); |
52 | |
|
53 | 180138 | if ( executionStack != null && !executionStackSet.containsKey(executionStack)) { |
54 | 0 | executionStackSet.put(executionStack, executionStack); |
55 | |
} |
56 | 180138 | } |
57 | |
|
58 | |
public synchronized Set<ExecutionStack> getExecutionStackSet() { |
59 | 0 | return new HashSet<ExecutionStack>(executionStackSet.keySet()); |
60 | |
} |
61 | |
|
62 | |
} |