KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > tanukisoftware > wrapper > jmx > WrapperManagerMBean


1 package org.tanukisoftware.wrapper.jmx;
2
3 /*
4  * Copyright (c) 1999, 2006 Tanuki Software Inc.
5  *
6  * Permission is hereby granted, free of charge, to any person
7  * obtaining a copy of the Java Service Wrapper and associated
8  * documentation files (the "Software"), to deal in the Software
9  * without restriction, including without limitation the rights
10  * to use, copy, modify, merge, publish, distribute, sub-license,
11  * and/or sell copies of the Software, and to permit persons to
12  * whom the Software is furnished to do so, subject to the
13  * following conditions:
14  *
15  * The above copyright notice and this permission notice shall be
16  * included in all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21  * NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25  * OTHER DEALINGS IN THE SOFTWARE.
26  */

27
28 /**
29  * @author Leif Mortenson <leif@tanukisoftware.com>
30  */

31 public interface WrapperManagerMBean
32 {
33     /**
34      * Obtain the current version of Wrapper.
35      *
36      * @return The version of the Wrapper.
37      */

38     String JavaDoc getVersion();
39     
40     /**
41      * Obtain the build time of Wrapper.
42      *
43      * @return The time that the Wrapper was built.
44      */

45     String JavaDoc getBuildTime();
46     
47     /**
48      * Returns the Id of the current JVM. JVM Ids increment from 1 each time
49      * the wrapper restarts a new one.
50      *
51      * @return The Id of the current JVM.
52      */

53     int getJVMId();
54     
55     /**
56      * Sets the title of the console in which the Wrapper is running. This
57      * is currently only supported on Windows platforms.
58      * <p>
59      * As an alternative, it is also possible to set the console title from
60      * within the wrapper.conf file using the wrapper.console.title property.
61      *
62      * @param title The new title. The specified string will be encoded
63      * to a byte array using the default encoding for the
64      * current platform.
65      */

66     void setConsoleTitle( String JavaDoc title );
67     
68     /**
69      * Returns the PID of the Wrapper process.
70      *
71      * A PID of 0 will be returned if the JVM was launched standalone.
72      *
73      * This value can also be obtained using the 'wrapper.pid' system property.
74      *
75      * @return The PID of the Wrpper process.
76      */

77     int getWrapperPID();
78     
79     /**
80      * Returns the PID of the Java process.
81      *
82      * A PID of 0 will be returned if the native library has not been initialized.
83      *
84      * This value can also be obtained using the 'wrapper.java.pid' system property.
85      *
86      * @return The PID of the Java process.
87      */

88     int getJavaPID();
89     
90     /**
91      * Requests that the current JVM process request a thread dump. This is
92      * the same as pressing CTRL-BREAK (under Windows) or CTRL-\ (under Unix)
93      * in the the console in which Java is running. This method does nothing
94      * if the native library is not loaded.
95      */

96     void requestThreadDump();
97     
98     /**
99      * Returns true if the JVM was launched by the Wrapper application. False
100      * if the JVM was launched manually without the Wrapper controlling it.
101      *
102      * @return True if the current JVM was launched by the Wrapper.
103      */

104     boolean isControlledByNativeWrapper();
105     
106     /**
107      * Returns true if the Wrapper was launched as an NT service on Windows or
108      * as a daemon process on UNIX platforms. False if launched as a console.
109      * This can be useful if you wish to display a user interface when in
110      * Console mode. On UNIX platforms, this is not as useful because an
111      * X display may not be visible even if launched in a console.
112      *
113      * @return True if the Wrapper is running as an NT service or daemon
114      * process.
115      */

116     boolean isLaunchedAsService();
117     
118     /**
119      * Returns true if the wrapper.debug property, or any of the logging
120      * channels are set to DEBUG in the wrapper configuration file. Useful
121      * for deciding whether or not to output certain information to the
122      * console.
123      *
124      * @return True if the Wrapper is logging any Debug level output.
125      */

126     boolean isDebugEnabled();
127     
128     /**
129      * Tells the native wrapper that the JVM wants to restart, then informs
130      * all listeners that the JVM is about to shutdown before killing the JVM.
131      * <p>
132      * The restart is actually performed in a background thread allowing JMX
133      * a chance to respond to the client.
134      */

135     void restart();
136     
137     /**
138      * Tells the native wrapper that the JVM wants to shut down, then informs
139      * all listeners that the JVM is about to shutdown before killing the JVM.
140      * <p>
141      * The stop is actually performed in a background thread allowing JMX
142      * a chance to respond to the client.
143      *
144      * @param exitCode The exit code that the Wrapper will return when it exits.
145      */

146     void stop( int exitCode );
147     
148     /**
149      * Returns true if the ShutdownHook for the JVM has already been triggered.
150      * Some code needs to know whether or not the system is shutting down.
151      *
152      * @return True if the ShutdownHook for the JVM has already been triggered.
153      */

154     boolean getHasShutdownHookBeenTriggered();
155 }
156
Popular Tags