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.HostMXBean; 36 import com.caucho.management.server.PersistentStoreMXBean; 37 import com.caucho.management.server.PortMXBean; 38 import com.caucho.management.server.ServerConnectorMXBean; 39 40 public class ClusterAdmin extends AbstractManagedObject 41 implements ClusterMXBean 42 { 43 private final Cluster _cluster; 44 45 public ClusterAdmin(Cluster cluster) 46 { 47 _cluster = cluster; 48 } 49 50 public String getName() 51 { 52 return _cluster.getId(); 53 } 54 55 public PortMXBean getPort() 56 { 57 ClusterServer clusterServer = _cluster.getSelfServer(); 58 59 if (clusterServer == null) 60 return null; 61 62 return clusterServer.getClusterPort().getAdmin(); 63 } 64 65 public PersistentStoreMXBean getPersistentStore() 66 { 67 return null; 68 } 69 70 public HostMXBean []getHosts() 71 { 72 return new HostMXBean[0]; 73 } 74 75 public ServerConnectorMXBean []getServers() 76 { 77 ClusterServer selfServer = _cluster.getSelfServer(); 78 79 ClusterServer[] serverList = _cluster.getServerList(); 80 81 int len = serverList.length; 82 83 if (selfServer != null) 84 len--; 85 86 ServerConnectorMXBean []serverMBeans = new ServerConnectorMXBean[len]; 87 88 int j = 0; 89 90 for (int i = 0; i < serverList.length; i++) { 91 ClusterServer server = serverList[i]; 92 93 if (server != selfServer) 94 serverMBeans[j++] = server.getServerConnector().getAdmin(); 95 } 96 97 return serverMBeans; 98 } 99 100 public String toString() 101 { 102 return "ClusterAdmin[" + getObjectName() + "]"; 103 } 104 } 105 | Popular Tags |