Example #1
0
  public synchronized Collection<GarbageCollectorMXBean> getGarbageCollectorMXBeans()
      throws IOException {

    // TODO: How to deal with changes to the list??
    if (garbageCollectorMBeans == null) {
      ObjectName gcName = null;
      try {
        gcName = new ObjectName(GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE + ",*");
      } catch (MalformedObjectNameException e) {
        // should not reach here
        assert (false);
      }
      Set<ObjectName> mbeans = server.queryNames(gcName, null);
      if (mbeans != null) {
        garbageCollectorMBeans = new ArrayList<GarbageCollectorMXBean>();
        Iterator<ObjectName> iterator = mbeans.iterator();
        while (iterator.hasNext()) {
          ObjectName on = (ObjectName) iterator.next();
          String name = GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE + ",name=" + on.getKeyProperty("name");

          GarbageCollectorMXBean mBean =
              newPlatformMXBeanProxy(server, name, GarbageCollectorMXBean.class);
          garbageCollectorMBeans.add(mBean);
        }
      }
    }
    return garbageCollectorMBeans;
  }
  public void createService() throws FioranoException {
    try {
      System.setProperty("java.rmi.server.hostname", RmiConnectorConfig.getConfig().getHostname());
      // Start Naming Service first.
      FioranoRMIMasterSocketFactory masterfac = FioranoRMIMasterSocketFactory.getInstance();
      List factories =
          masterfac.getSocketFactories(
              "FioranoRMIServerSocketFactory", "FioranoRMIClientSocketFactory");

      csf = (RMIClientSocketFactory) factories.get(0);
      ssf = (RMIServerSocketFactory) factories.get(1);
      setRmiRegistryIpAddress(); // ---->do before starting fiorano naming service !
      // namingService = new FioranoNamingService(rmiConnectorConfig.getRmiRegistryPort(),csf,ssf);
      namingService =
          new FioranoNamingService(RmiConnectorConfig.getConfig().getRmiRegistryPort(), csf, ssf);
      namingService.start();
      System.out.println(
          "RMI registry listening on " + RmiConnectorConfig.getConfig().getRmiRegistryPort());
    } catch (Exception ex) {

    }
  }
Example #3
0
  public Collection<MemoryPoolProxy> getMemoryPoolProxies() throws IOException {

    // TODO: How to deal with changes to the list??
    if (memoryPoolProxies == null) {
      ObjectName poolName = null;
      try {
        poolName = new ObjectName(MEMORY_POOL_MXBEAN_DOMAIN_TYPE + ",*");
      } catch (MalformedObjectNameException e) {
        // should not reach here
        assert (false);
      }
      Set<ObjectName> mbeans = server.queryNames(poolName, null);
      if (mbeans != null) {
        memoryPoolProxies = new ArrayList<MemoryPoolProxy>();
        Iterator<ObjectName> iterator = mbeans.iterator();
        while (iterator.hasNext()) {
          ObjectName objName = (ObjectName) iterator.next();
          MemoryPoolProxy p = new MemoryPoolProxy(this, objName);
          memoryPoolProxies.add(p);
        }
      }
    }
    return memoryPoolProxies;
  }