1 29 30 31 package com.caucho.server.cluster; 32 33 import com.caucho.management.server.AbstractManagedObject; 34 import com.caucho.management.server.ClusterMXBean; 35 import com.caucho.management.server.ServerConnectorMXBean; 36 37 import java.util.Date ; 38 39 42 public class ServerConnectorAdmin extends AbstractManagedObject 43 implements ServerConnectorMXBean 44 { 45 private final ClusterClient _client; 46 47 public ServerConnectorAdmin(ClusterClient client) 48 { 49 _client = client; 50 } 51 52 55 public String getName() 56 { 57 return _client.getServer().getId(); 58 } 59 60 public String getType() 61 { 62 return "ServerConnector"; 63 } 64 65 68 public ClusterMXBean getCluster() 69 { 70 return _client.getServer().getCluster().getAdmin(); 71 } 72 73 76 public int getClusterIndex() 77 { 78 return _client.getServer().getIndex(); 79 } 80 81 84 public String getAddress() 85 { 86 return _client.getServer().getAddress(); 87 } 88 89 92 public int getPort() 93 { 94 return _client.getServer().getPort(); 95 } 96 97 101 105 public long getRecoverTime() 106 { 107 return _client.getServer().getLoadBalanceRecoverTime(); 108 } 109 110 113 public long getIdleTime() 114 { 115 return _client.getServer().getLoadBalanceIdleTime(); 116 } 117 118 121 public long getConnectTimeout() 122 { 123 return _client.getServer().getLoadBalanceConnectTimeout(); 124 } 125 126 129 public long getSocketTimeout() 130 { 131 return _client.getServer().getSocketTimeout(); 132 } 133 134 137 public long getWarmupTime() 138 { 139 return _client.getServer().getLoadBalanceWarmupTime(); 140 } 141 142 145 public int getWeight() 146 { 147 return _client.getServer().getLoadBalanceWeight(); 148 } 149 150 154 public String getState() 155 { 156 return _client.getState(); 157 } 158 159 public int getConnectionActiveCount() 160 { 161 return _client.getActiveCount(); 162 } 163 164 public int getConnectionIdleCount() 165 { 166 return _client.getIdleCount(); 167 } 168 169 public long getConnectionNewCountTotal() 170 { 171 return _client.getConnectCountTotal(); 172 } 173 174 public long getConnectionFailCountTotal() 175 { 176 return _client.getFailCountTotal(); 177 } 178 179 public Date getLastFailTime() 180 { 181 return _client.getLastFailTime(); 182 } 183 184 public long getConnectionBusyCountTotal() 185 { 186 return _client.getBusyCountTotal(); 187 } 188 189 public Date getLastBusyTime() 190 { 191 return _client.getLastBusyTime(); 192 } 193 194 public long getConnectionKeepaliveCountTotal() 195 { 196 return _client.getServer().getClient().getKeepaliveCountTotal(); 197 } 198 199 public double getServerCpuLoadAvg() 200 { 201 return _client.getServer().getClient().getCpuLoadAvg(); 202 } 203 204 public void start() 205 { 206 _client.start(); 207 } 208 209 public void stop() 210 { 211 _client.stop(); 212 } 213 214 public void enableSessionOnly() 215 { 216 _client.enableSessionOnly(); 217 } 218 219 public boolean ping() 220 { 221 return _client.getServer().canConnect(); 222 } 223 224 protected void register() 225 { 226 registerSelf(); 227 } 228 229 public String toString() 230 { 231 return "ClusterClientAdmin[" + getObjectName() + "]"; 232 } 233 } 234 | Popular Tags |