001: package org.tanukisoftware.wrapper.jmx;
002:
003: /*
004: * Copyright (c) 1999, 2006 Tanuki Software Inc.
005: *
006: * Permission is hereby granted, free of charge, to any person
007: * obtaining a copy of the Java Service Wrapper and associated
008: * documentation files (the "Software"), to deal in the Software
009: * without restriction, including without limitation the rights
010: * to use, copy, modify, merge, publish, distribute, sub-license,
011: * and/or sell copies of the Software, and to permit persons to
012: * whom the Software is furnished to do so, subject to the
013: * following conditions:
014: *
015: * The above copyright notice and this permission notice shall be
016: * included in all copies or substantial portions of the Software.
017: *
018: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
019: * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
020: * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
021: * NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
022: * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
023: * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
024: * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
025: * OTHER DEALINGS IN THE SOFTWARE.
026: */
027:
028: /**
029: * @author Leif Mortenson <leif@tanukisoftware.com>
030: */
031: public interface WrapperManagerMBean {
032: /**
033: * Obtain the current version of Wrapper.
034: *
035: * @return The version of the Wrapper.
036: */
037: String getVersion();
038:
039: /**
040: * Obtain the build time of Wrapper.
041: *
042: * @return The time that the Wrapper was built.
043: */
044: String getBuildTime();
045:
046: /**
047: * Returns the Id of the current JVM. JVM Ids increment from 1 each time
048: * the wrapper restarts a new one.
049: *
050: * @return The Id of the current JVM.
051: */
052: int getJVMId();
053:
054: /**
055: * Sets the title of the console in which the Wrapper is running. This
056: * is currently only supported on Windows platforms.
057: * <p>
058: * As an alternative, it is also possible to set the console title from
059: * within the wrapper.conf file using the wrapper.console.title property.
060: *
061: * @param title The new title. The specified string will be encoded
062: * to a byte array using the default encoding for the
063: * current platform.
064: */
065: void setConsoleTitle(String title);
066:
067: /**
068: * Returns the PID of the Wrapper process.
069: *
070: * A PID of 0 will be returned if the JVM was launched standalone.
071: *
072: * This value can also be obtained using the 'wrapper.pid' system property.
073: *
074: * @return The PID of the Wrpper process.
075: */
076: int getWrapperPID();
077:
078: /**
079: * Returns the PID of the Java process.
080: *
081: * A PID of 0 will be returned if the native library has not been initialized.
082: *
083: * This value can also be obtained using the 'wrapper.java.pid' system property.
084: *
085: * @return The PID of the Java process.
086: */
087: int getJavaPID();
088:
089: /**
090: * Requests that the current JVM process request a thread dump. This is
091: * the same as pressing CTRL-BREAK (under Windows) or CTRL-\ (under Unix)
092: * in the the console in which Java is running. This method does nothing
093: * if the native library is not loaded.
094: */
095: void requestThreadDump();
096:
097: /**
098: * Returns true if the JVM was launched by the Wrapper application. False
099: * if the JVM was launched manually without the Wrapper controlling it.
100: *
101: * @return True if the current JVM was launched by the Wrapper.
102: */
103: boolean isControlledByNativeWrapper();
104:
105: /**
106: * Returns true if the Wrapper was launched as an NT service on Windows or
107: * as a daemon process on UNIX platforms. False if launched as a console.
108: * This can be useful if you wish to display a user interface when in
109: * Console mode. On UNIX platforms, this is not as useful because an
110: * X display may not be visible even if launched in a console.
111: *
112: * @return True if the Wrapper is running as an NT service or daemon
113: * process.
114: */
115: boolean isLaunchedAsService();
116:
117: /**
118: * Returns true if the wrapper.debug property, or any of the logging
119: * channels are set to DEBUG in the wrapper configuration file. Useful
120: * for deciding whether or not to output certain information to the
121: * console.
122: *
123: * @return True if the Wrapper is logging any Debug level output.
124: */
125: boolean isDebugEnabled();
126:
127: /**
128: * Tells the native wrapper that the JVM wants to restart, then informs
129: * all listeners that the JVM is about to shutdown before killing the JVM.
130: * <p>
131: * The restart is actually performed in a background thread allowing JMX
132: * a chance to respond to the client.
133: */
134: void restart();
135:
136: /**
137: * Tells the native wrapper that the JVM wants to shut down, then informs
138: * all listeners that the JVM is about to shutdown before killing the JVM.
139: * <p>
140: * The stop is actually performed in a background thread allowing JMX
141: * a chance to respond to the client.
142: *
143: * @param exitCode The exit code that the Wrapper will return when it exits.
144: */
145: void stop(int exitCode);
146:
147: /**
148: * Returns true if the ShutdownHook for the JVM has already been triggered.
149: * Some code needs to know whether or not the system is shutting down.
150: *
151: * @return True if the ShutdownHook for the JVM has already been triggered.
152: */
153: boolean getHasShutdownHookBeenTriggered();
154: }
|