1 6 package org.logicalcobwebs.proxool.admin; 7 8 import org.apache.commons.logging.Log; 9 import org.apache.commons.logging.LogFactory; 10 import org.logicalcobwebs.proxool.ConnectionInfoIF; 11 12 import java.util.Collection ; 13 import java.util.Date ; 14 15 23 class Snapshot implements SnapshotIF { 24 25 private static final Log LOG = LogFactory.getLog(Snapshot.class); 26 27 private Date dateStarted; 28 29 private long servedCount; 30 31 private long refusedCount; 32 33 private int activeConnectionCount; 34 35 private int availableConnectionCount; 36 37 private int offlineConnectionCount; 38 39 private int maximumConnectionCount; 40 41 private Date snapshotDate; 42 43 private Collection connectionInfos; 44 45 private long connectionCount; 46 47 50 public Snapshot(Date snapshotDate) { 51 this.snapshotDate = snapshotDate; 52 } 53 54 57 public Date getDateStarted() { 58 return dateStarted; 59 } 60 61 64 public void setDateStarted(Date dateStarted) { 65 this.dateStarted = dateStarted; 66 } 67 68 71 public long getServedCount() { 72 return servedCount; 73 } 74 75 78 public void setServedCount(long servedCount) { 79 this.servedCount = servedCount; 80 } 81 82 85 public long getRefusedCount() { 86 return refusedCount; 87 } 88 89 92 public void setRefusedCount(long refusedCount) { 93 this.refusedCount = refusedCount; 94 } 95 96 99 public int getActiveConnectionCount() { 100 return activeConnectionCount; 101 } 102 103 106 public void setActiveConnectionCount(int activeConnectionCount) { 107 this.activeConnectionCount = activeConnectionCount; 108 } 109 110 113 public int getAvailableConnectionCount() { 114 return availableConnectionCount; 115 } 116 117 120 public void setAvailableConnectionCount(int availableConnectionCount) { 121 this.availableConnectionCount = availableConnectionCount; 122 } 123 124 127 public int getOfflineConnectionCount() { 128 return offlineConnectionCount; 129 } 130 131 134 public void setOfflineConnectionCount(int offlineConnectionCount) { 135 this.offlineConnectionCount = offlineConnectionCount; 136 } 137 138 141 public int getMaximumConnectionCount() { 142 return maximumConnectionCount; 143 } 144 145 148 public void setMaximumConnectionCount(int maximumConnectionCount) { 149 this.maximumConnectionCount = maximumConnectionCount; 150 } 151 152 155 public Date getSnapshotDate() { 156 return snapshotDate; 157 } 158 159 162 public ConnectionInfoIF[] getConnectionInfos() { 163 return (ConnectionInfoIF[]) connectionInfos.toArray(new ConnectionInfoIF[connectionInfos.size()]); 164 } 165 166 169 public void setConnectionInfos(Collection connectionInfos) { 170 this.connectionInfos = connectionInfos; 171 } 172 173 176 public ConnectionInfoIF getConnectionInfo(long id) { 177 ConnectionInfoIF connectionInfo = null; 178 ConnectionInfoIF[] connectionInfos = getConnectionInfos(); 179 for (int i = 0; i < connectionInfos.length; i++) { 180 if (connectionInfos[i].getId() == id) { 181 connectionInfo = connectionInfos[i]; 182 } 183 } 184 return connectionInfo; 185 } 186 187 190 public boolean isDetail() { 191 return connectionInfos != null; 192 } 193 194 public long getConnectionCount() { 195 return connectionCount; 196 } 197 198 public void setConnectionCount(long connectionCount) { 199 this.connectionCount = connectionCount; 200 } 201 } 202 203 204 | Popular Tags |