KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > deployment > profiler > api > ProfilerSupport


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.j2ee.deployment.profiler.api;
21
22 import org.netbeans.modules.j2ee.deployment.impl.ServerRegistry;
23 import org.netbeans.modules.j2ee.deployment.profiler.spi.Profiler;
24
25 /**
26  * Allows to determine current state of a Profiler registered in the default Lookup.
27  *
28  * @author sherold
29  */

30 public final class ProfilerSupport {
31
32     /**
33      * The Profiler agent isn't running.
34      */

35     public static int STATE_INACTIVE = 0;
36
37     /**
38      * The Profiler agent is starting to STATE_BLOCKING or STATE_RUNNING state,
39      * target JVM isn't running.
40      */

41     public static int STATE_STARTING = 1;
42     
43     /**
44      * The Profiler agent is running and ready for the Profiler to connect, target
45      * JVM is blocked.
46      */

47     public static int STATE_BLOCKING = 2;
48     
49     /**
50      * The Profiler agent is running and ready for the Profiler to connect, target
51      * JVM is running.
52      */

53     public static int STATE_RUNNING = 3;
54     
55     /**
56      * The Profiler agent is running and connected to Profiler, target JVM is running.
57      */

58     public static int STATE_PROFILING = 4;
59     
60     /**
61      * Returns the current state of a Profiler registered into Lookup.
62      *
63      * @return the current profiler state or <code>STATE_INACTIVE</code> if no
64      * Profiler is registered in the default Lookup.
65      */

66     public static int getState() {
67         Profiler profiler = ServerRegistry.getProfiler();
68         return profiler == null ? STATE_INACTIVE
69                                 : profiler.getState();
70     }
71 }
72
Popular Tags