Class WrapperManager

java.lang.Object
org.tanukisoftware.wrapper.jmx.WrapperManager
All Implemented Interfaces:
WrapperManagerMBean

public class WrapperManager extends Object implements WrapperManagerMBean
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Obtain the build time of Wrapper.
    boolean
    Returns true if the ShutdownHook for the JVM has already been triggered.
    int
    Returns the PID of the Java process.
    int
    Returns the Id of the current JVM.
    Obtain the current version of Wrapper.
    int
    Returns the PID of the Wrapper process.
    boolean
    Returns true if the JVM was launched by the Wrapper application.
    boolean
    Returns true if the wrapper.debug property, or any of the logging channels are set to DEBUG in the wrapper configuration file.
    boolean
    Returns true if the Wrapper was launched as an NT service on Windows or as a daemon process on UNIX platforms.
    boolean
    Returns true if the current Wrapper edition has support for Professional Edition features.
    boolean
    Returns true if the current Wrapper edition has support for Standard Edition features.
    void
    Requests that the current JVM process request a thread dump.
    void
    Tells the native wrapper that the JVM wants to restart, then informs all listeners that the JVM is about to shutdown before killing the JVM.
    void
    Sets the title of the console in which the Wrapper is running.
    void
    stop(int exitCode)
    Tells the native wrapper that the JVM wants to shut down, then informs all listeners that the JVM is about to shutdown before killing the JVM.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • WrapperManager

      public WrapperManager()
  • Method Details

    • getVersion

      public String getVersion()
      Obtain the current version of Wrapper.
      Specified by:
      getVersion in interface WrapperManagerMBean
      Returns:
      The version of the Wrapper.
    • getBuildTime

      public String getBuildTime()
      Obtain the build time of Wrapper.
      Specified by:
      getBuildTime in interface WrapperManagerMBean
      Returns:
      The time that the Wrapper was built.
    • getJVMId

      public int getJVMId()
      Returns the Id of the current JVM. JVM Ids increment from 1 each time the wrapper restarts a new one.
      Specified by:
      getJVMId in interface WrapperManagerMBean
      Returns:
      The Id of the current JVM.
    • isProfessionalEdition

      public boolean isProfessionalEdition()
      Returns true if the current Wrapper edition has support for Professional Edition features.
      Specified by:
      isProfessionalEdition in interface WrapperManagerMBean
      Returns:
      True if professional features are supported.
    • isStandardEdition

      public boolean isStandardEdition()
      Returns true if the current Wrapper edition has support for Standard Edition features.
      Specified by:
      isStandardEdition in interface WrapperManagerMBean
      Returns:
      True if standard features are supported.
    • setConsoleTitle

      public void setConsoleTitle(String title)
      Sets the title of the console in which the Wrapper is running. This is currently only supported on Windows platforms.

      As an alternative, it is also possible to set the console title from within the wrapper.conf file using the wrapper.console.title property.

      Specified by:
      setConsoleTitle in interface WrapperManagerMBean
      Parameters:
      title - The new title. The specified string will be encoded to a byte array using the default encoding for the current platform.
    • getWrapperPID

      public int getWrapperPID()
      Returns the PID of the Wrapper process. A PID of 0 will be returned if the JVM was launched standalone. This value can also be obtained using the 'wrapper.pid' system property.
      Specified by:
      getWrapperPID in interface WrapperManagerMBean
      Returns:
      The PID of the Wrpper process.
    • getJavaPID

      public int getJavaPID()
      Returns the PID of the Java process. A PID of 0 will be returned if the native library has not been initialized. This value can also be obtained using the 'wrapper.java.pid' system property.
      Specified by:
      getJavaPID in interface WrapperManagerMBean
      Returns:
      The PID of the Java process.
    • requestThreadDump

      public void requestThreadDump()
      Requests that the current JVM process request a thread dump. This is the same as pressing CTRL-BREAK (under Windows) or CTRL-\ (under Unix) in the the console in which Java is running. This method does nothing if the native library is not loaded.
      Specified by:
      requestThreadDump in interface WrapperManagerMBean
    • isControlledByNativeWrapper

      public boolean isControlledByNativeWrapper()
      Returns true if the JVM was launched by the Wrapper application. False if the JVM was launched manually without the Wrapper controlling it.
      Specified by:
      isControlledByNativeWrapper in interface WrapperManagerMBean
      Returns:
      True if the current JVM was launched by the Wrapper.
    • isLaunchedAsService

      public boolean isLaunchedAsService()
      Returns true if the Wrapper was launched as an NT service on Windows or as a daemon process on UNIX platforms. False if launched as a console. This can be useful if you wish to display a user interface when in Console mode. On UNIX platforms, this is not as useful because an X display may not be visible even if launched in a console.
      Specified by:
      isLaunchedAsService in interface WrapperManagerMBean
      Returns:
      True if the Wrapper is running as an NT service or daemon process.
    • isDebugEnabled

      public boolean isDebugEnabled()
      Returns true if the wrapper.debug property, or any of the logging channels are set to DEBUG in the wrapper configuration file. Useful for deciding whether or not to output certain information to the console.
      Specified by:
      isDebugEnabled in interface WrapperManagerMBean
      Returns:
      True if the Wrapper is logging any Debug level output.
    • restart

      public void restart()
      Tells the native wrapper that the JVM wants to restart, then informs all listeners that the JVM is about to shutdown before killing the JVM.

      The restart is actually performed in a background thread allowing JMX a chance to respond to the client.

      Specified by:
      restart in interface WrapperManagerMBean
    • stop

      public void stop(int exitCode)
      Tells the native wrapper that the JVM wants to shut down, then informs all listeners that the JVM is about to shutdown before killing the JVM.

      The stop is actually performed in a background thread allowing JMX a chance to respond to the client.

      Specified by:
      stop in interface WrapperManagerMBean
      Parameters:
      exitCode - The exit code that the Wrapper will return when it exits.
    • getHasShutdownHookBeenTriggered

      public boolean getHasShutdownHookBeenTriggered()
      Returns true if the ShutdownHook for the JVM has already been triggered. Some code needs to know whether or not the system is shutting down.
      Specified by:
      getHasShutdownHookBeenTriggered in interface WrapperManagerMBean
      Returns:
      True if the ShutdownHook for the JVM has already been triggered.