KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > util > pool > EchoPoolListener


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 //NOTE: Tabs are used instead of spaces for indentation.
25
// Make sure that your editor does not replace tabs with spaces.
26
// Set the tab length using your favourite editor to your
27
// visual preference.
28

29 /*
30  * Filename: EchoPoolListener.java
31  *
32  * Copyright 2000-2001 by iPlanet/Sun Microsystems, Inc.,
33  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
34  * All rights reserved.
35  *
36  * This software is the confidential and proprietary information
37  * of iPlanet/Sun Microsystems, Inc. ("Confidential Information").
38  * You shall not disclose such Confidential Information and shall
39  * use it only in accordance with the terms of the license
40  * agreement you entered into with iPlanet/Sun Microsystems.
41  */

42  
43 /**
44  * <BR> <I>$Source: /cvs/glassfish/appserv-commons/src/java/com/sun/enterprise/util/pool/EchoPoolListener.java,v $</I>
45  * @author $Author: tcfujii $
46  * @version $Revision: 1.3 $ $Date: 2005/12/25 04:12:26 $
47  */

48  
49 package com.sun.enterprise.util.pool;
50
51 import java.rmi.RemoteException JavaDoc;
52 //Bug 4677074 begin
53
import java.util.logging.Logger JavaDoc;
54 import java.util.logging.Level JavaDoc;
55 import com.sun.logging.LogDomains;
56 //Bug 4677074 end
57

58 /**
59  * PoolListeners receive notification from the PoolHandler.
60  */

61 public class EchoPoolListener
62     implements PoolListener
63 {
64 //Bug 4677074 begin
65
static Logger JavaDoc _logger=LogDomains.getLogger(LogDomains.UTIL_LOGGER);
66 //Bug 4677074 end
67
private boolean debug = false;
68
69     /**
70      * called after an object has been created.
71      */

72     public void afterCreate(Object JavaDoc object) {
73         if ( com.sun.enterprise.util.logging.Debug.enabled )
74 //Bug 4677074 System.out.println(this + ": afterCreate(" + object + ");");
75
//Bug 4677074 begin
76
_logger.log(Level.FINE,this + ": afterCreate(" + object + ");");
77 //Bug 4677074 end
78
}
79        
80     /**
81      * called before an object is to be destroyed.
82      */

83     public void beforeDestroy(Object JavaDoc object) {
84         if ( com.sun.enterprise.util.logging.Debug.enabled )
85 //Bug 4677074 System.out.println(this + ": beforeDestroy(" + object + ");");
86
//Bug 4677074 begin
87
_logger.log(Level.FINE,this + ": beforeDestroy(" + object + ");");
88 //Bug 4677074 end
89
}
90        
91     /**
92      * Called by the thread that is about to wait.
93      */

94     public void beforeWait(Object JavaDoc object) {
95         if ( com.sun.enterprise.util.logging.Debug.enabled )
96 //Bug 4677074 System.out.println(this + ": beforeWait(" + object + ");");
97
//Bug 4677074 begin
98
_logger.log(Level.FINE,this + ": beforeWait(" + object + ");");
99 //Bug 4677074 end
100
}
101        
102     /**
103      * Called by the thread that has been notified.
104      */

105     public void afterNotify(Object JavaDoc object) {
106         if ( com.sun.enterprise.util.logging.Debug.enabled )
107 //Bug 4677074 System.out.println(this + ": afterNotify(" + object + ");");
108
//Bug 4677074 begin
109
_logger.log(Level.FINE,this + ": afterNotify(" + object + ");");
110 //Bug 4677074 end
111
}
112    
113    
114    
115     /**
116      * Called when the pool is recycled.
117      */

118     public void onRecycle() {
119         if ( com.sun.enterprise.util.logging.Debug.enabled )
120 //Bug 4677074 System.out.println(this + ": pool recycled......");
121
//Bug 4677074 begin
122
_logger.log(Level.FINE,this + ": pool recycled......");
123 //Bug 4677074 end
124
}
125     
126     /**
127      * Called when the pool is on hold.
128      */

129     public void beforeHold() {
130         if ( com.sun.enterprise.util.logging.Debug.enabled )
131 //Bug 4677074 System.out.println(this + ": pool on hold......");
132
//Bug 4677074 begin
133
_logger.log(Level.FINE,this + ": pool on hold......");
134 //Bug 4677074 end
135
}
136     
137     /**
138      * Called when the pool is out of hold.
139      */

140     public void afterHold() {
141         if ( com.sun.enterprise.util.logging.Debug.enabled )
142 //Bug 4677074 System.out.println(this + ": pool out of hold......");
143
//Bug 4677074 begin
144
_logger.log(Level.FINE,this + ": pool out of hold......");
145 //Bug 4677074 end
146
}
147     
148     /**
149      * Called when the pool is closed.
150      */

151     public void onClose() {
152         if ( com.sun.enterprise.util.logging.Debug.enabled )
153 //Bug 4677074 System.out.println(this + ": pool closed......");
154
//Bug 4677074 begin
155
_logger.log(Level.FINE,this + ": pool closed......");
156 //Bug 4677074 end
157
}
158    
159 }
160
Popular Tags