Source Code Cross Referenced for WrapperManager.java in  » Collaboration » Java-Service-Wrapper » org » tanukisoftware » wrapper » jmx » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Collaboration » Java Service Wrapper » org.tanukisoftware.wrapper.jmx 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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 class WrapperManager implements  WrapperManagerMBean {
032:            /*---------------------------------------------------------------
033:             * WrapperManagerMBean Methods
034:             *-------------------------------------------------------------*/
035:            /**
036:             * Obtain the current version of Wrapper.
037:             *
038:             * @return The version of the Wrapper.
039:             */
040:            public String getVersion() {
041:                return org.tanukisoftware.wrapper.WrapperManager.getVersion();
042:            }
043:
044:            /**
045:             * Obtain the build time of Wrapper.
046:             *
047:             * @return The time that the Wrapper was built.
048:             */
049:            public String getBuildTime() {
050:                return org.tanukisoftware.wrapper.WrapperManager.getBuildTime();
051:            }
052:
053:            /**
054:             * Returns the Id of the current JVM.  JVM Ids increment from 1 each time
055:             *  the wrapper restarts a new one.
056:             *
057:             * @return The Id of the current JVM.
058:             */
059:            public int getJVMId() {
060:                return org.tanukisoftware.wrapper.WrapperManager.getJVMId();
061:            }
062:
063:            /**
064:             * Sets the title of the console in which the Wrapper is running.  This
065:             *  is currently only supported on Windows platforms.
066:             * <p>
067:             * As an alternative, it is also possible to set the console title from
068:             *  within the wrapper.conf file using the wrapper.console.title property.
069:             *
070:             * @param title The new title.  The specified string will be encoded
071:             *              to a byte array using the default encoding for the
072:             *              current platform.
073:             */
074:            public void setConsoleTitle(String title) {
075:                org.tanukisoftware.wrapper.WrapperManager
076:                        .setConsoleTitle(title);
077:            }
078:
079:            /**
080:             * Returns the PID of the Wrapper process.
081:             *
082:             * A PID of 0 will be returned if the JVM was launched standalone.
083:             *
084:             * This value can also be obtained using the 'wrapper.pid' system property.
085:             *
086:             * @return The PID of the Wrpper process.
087:             */
088:            public int getWrapperPID() {
089:                return org.tanukisoftware.wrapper.WrapperManager
090:                        .getWrapperPID();
091:            }
092:
093:            /**
094:             * Returns the PID of the Java process.
095:             *
096:             * A PID of 0 will be returned if the native library has not been initialized.
097:             *
098:             * This value can also be obtained using the 'wrapper.java.pid' system property.
099:             *
100:             * @return The PID of the Java process.
101:             */
102:            public int getJavaPID() {
103:                return org.tanukisoftware.wrapper.WrapperManager.getJavaPID();
104:            }
105:
106:            /**
107:             * Requests that the current JVM process request a thread dump.  This is
108:             *  the same as pressing CTRL-BREAK (under Windows) or CTRL-\ (under Unix)
109:             *  in the the console in which Java is running.  This method does nothing
110:             *  if the native library is not loaded.
111:             */
112:            public void requestThreadDump() {
113:                org.tanukisoftware.wrapper.WrapperManager.requestThreadDump();
114:            }
115:
116:            /**
117:             * Returns true if the JVM was launched by the Wrapper application.  False
118:             *  if the JVM was launched manually without the Wrapper controlling it.
119:             *
120:             * @return True if the current JVM was launched by the Wrapper.
121:             */
122:            public boolean isControlledByNativeWrapper() {
123:                return org.tanukisoftware.wrapper.WrapperManager
124:                        .isControlledByNativeWrapper();
125:            }
126:
127:            /**
128:             * Returns true if the Wrapper was launched as an NT service on Windows or
129:             *  as a daemon process on UNIX platforms.  False if launched as a console.
130:             *  This can be useful if you wish to display a user interface when in
131:             *  Console mode.  On UNIX platforms, this is not as useful because an
132:             *  X display may not be visible even if launched in a console.
133:             *
134:             * @return True if the Wrapper is running as an NT service or daemon
135:             *         process.
136:             */
137:            public boolean isLaunchedAsService() {
138:                return org.tanukisoftware.wrapper.WrapperManager
139:                        .isLaunchedAsService();
140:            }
141:
142:            /**
143:             * Returns true if the wrapper.debug property, or any of the logging
144:             *  channels are set to DEBUG in the wrapper configuration file.  Useful
145:             *  for deciding whether or not to output certain information to the
146:             *  console.
147:             *
148:             * @return True if the Wrapper is logging any Debug level output.
149:             */
150:            public boolean isDebugEnabled() {
151:                return org.tanukisoftware.wrapper.WrapperManager
152:                        .isDebugEnabled();
153:            }
154:
155:            /**
156:             * Tells the native wrapper that the JVM wants to restart, then informs
157:             *	all listeners that the JVM is about to shutdown before killing the JVM.
158:             * <p>
159:             * The restart is actually performed in a background thread allowing JMX
160:             *  a chance to respond to the client.
161:             */
162:            public void restart() {
163:                // This action normally will not return, so launch it in a background
164:                //  thread giving JMX a chance to return a response to its client.
165:                new Thread() {
166:                    public void run() {
167:                        try {
168:                            Thread.sleep(1000);
169:                        } catch (InterruptedException e) {
170:                        }
171:
172:                        org.tanukisoftware.wrapper.WrapperManager.restart();
173:                    }
174:                }.start();
175:            }
176:
177:            /**
178:             * Tells the native wrapper that the JVM wants to shut down, then informs
179:             *	all listeners that the JVM is about to shutdown before killing the JVM.
180:             * <p>
181:             * The stop is actually performed in a background thread allowing JMX
182:             *  a chance to respond to the client.
183:             *
184:             * @param exitCode The exit code that the Wrapper will return when it exits.
185:             */
186:            public void stop(final int exitCode) {
187:                // This action normally will not return, so launch it in a background
188:                //  thread giving JMX a chance to return a response to its client.
189:                new Thread() {
190:                    public void run() {
191:                        try {
192:                            Thread.sleep(1000);
193:                        } catch (InterruptedException e) {
194:                        }
195:
196:                        org.tanukisoftware.wrapper.WrapperManager
197:                                .stop(exitCode);
198:                    }
199:                }.start();
200:            }
201:
202:            /**
203:             * Returns true if the ShutdownHook for the JVM has already been triggered.
204:             *  Some code needs to know whether or not the system is shutting down.
205:             *
206:             * @return True if the ShutdownHook for the JVM has already been triggered.
207:             */
208:            public boolean getHasShutdownHookBeenTriggered() {
209:                return org.tanukisoftware.wrapper.WrapperManager
210:                        .hasShutdownHookBeenTriggered();
211:            }
212:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.