1
2
3
4
5
6
7
8
9
10
11 package psiprobe.model;
12
13
14
15
16
17 public class DataSourceInfoGroup extends DataSourceInfo {
18
19
20 private int dataSourceCount;
21
22
23
24
25 public DataSourceInfoGroup() {
26 this.setJdbcUrl(null);
27 this.setBusyConnections(0);
28 this.setEstablishedConnections(0);
29 this.setMaxConnections(0);
30 }
31
32
33
34
35
36
37
38
39 public DataSourceInfoGroup builder(DataSourceInfo dataSourceInfo) {
40 this.setJdbcUrl(dataSourceInfo.getJdbcUrl());
41 this.setBusyConnections(dataSourceInfo.getBusyConnections());
42 this.setEstablishedConnections(dataSourceInfo.getEstablishedConnections());
43 this.setMaxConnections(dataSourceInfo.getMaxConnections());
44 this.setDataSourceCount(1);
45 return this;
46 }
47
48
49
50
51
52
53 public int getDataSourceCount() {
54 return dataSourceCount;
55 }
56
57
58
59
60
61
62 public void setDataSourceCount(int dataSourceCount) {
63 this.dataSourceCount = dataSourceCount;
64 }
65
66
67
68
69
70
71 public void addBusyConnections(int busyConnectionsDelta) {
72 setBusyConnections(getBusyConnections() + busyConnectionsDelta);
73 }
74
75
76
77
78
79
80 public void addEstablishedConnections(int establishedConnectionsDelta) {
81 setEstablishedConnections(getEstablishedConnections() + establishedConnectionsDelta);
82 }
83
84
85
86
87
88
89 public void addMaxConnections(int maxConnectionsDelta) {
90 setMaxConnections(getMaxConnections() + maxConnectionsDelta);
91 }
92
93
94
95
96
97
98 public void addDataSourceCount(int dataSourceCountDelta) {
99 setDataSourceCount(getDataSourceCount() + dataSourceCountDelta);
100 }
101
102
103
104
105
106
107 public void addDataSourceInfo(DataSourceInfo dataSourceInfoDelta) {
108 addBusyConnections(dataSourceInfoDelta.getBusyConnections());
109 addEstablishedConnections(dataSourceInfoDelta.getEstablishedConnections());
110 addMaxConnections(dataSourceInfoDelta.getMaxConnections());
111 addDataSourceCount(1);
112 }
113
114 }