Package ch.goodsolutions.olat.jmx

Source Code of ch.goodsolutions.olat.jmx.OLATIdentifier

package ch.goodsolutions.olat.jmx;

import java.lang.management.ManagementFactory;
import java.lang.management.MemoryMXBean;

import org.olat.core.CoreSpringFactory;
import org.olat.core.Version;
import org.olat.core.gui.control.DefaultController;
import org.olat.core.helpers.Settings;
import org.olat.core.util.UserSession;
import org.olat.core.util.WebappHelper;

/**
* OLAT - Online Learning and Training<br>
* http://www.olat.org
* <p>
* This software is protected by the OLAT software license.<br>
* Use is subject to license terms.<br>
* See LICENSE.TXT in this distribution for details.
* <p>
* Copyright (c) 2005-2006 by JGS goodsolutions GmbH, Switzerland<br>
* http://www.goodsolutions.ch
*
* All rights reserved.
* <p>
*/
public class OLATIdentifier implements OLATIdentifierMBean {

  public static final String IDENTIFIER = "genuineOLAT";
  private static MemoryMXBean mbean = ManagementFactory.getMemoryMXBean();
 
  public String getInstanceID() {
    return WebappHelper.getInstanceId();
  }

  public String getVersion() {
    Version v = (Version)CoreSpringFactory.getBean("org.olat.core.Version");
    return v.getVersion();
  }

  public String getBuild() {
    Version v = (Version)CoreSpringFactory.getBean("org.olat.core.Version");
    return v.getBuild();
  }

  public String getContextPath() {
    return WebappHelper.getServletContextPath();
  }
 
  public String getWebAppUri() {
    return Settings.getServerContextPathURI();
  }

  public int getAuthenticatedUsersCount() {
    return UserSession.getAuthenticatedUserSessions().size();
  }
 
  public long getMemoryHeapUsageKB() {
    return mbean.getHeapMemoryUsage().getUsed() / 1024;
  }
 
  public long getControllerCount() {
    return DefaultController.getControllerCount();
  }
 
  public long getThreadCount() {
    ThreadGroup tg = Thread.currentThread().getThreadGroup();
    return tg.activeCount();
  }
}
TOP

Related Classes of ch.goodsolutions.olat.jmx.OLATIdentifier

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.