KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > resource > UnpooledConnectionEventListener


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 package com.sun.enterprise.resource;
24 import javax.resource.spi.*;
25 import java.util.logging.Logger JavaDoc;
26 import java.util.logging.Level JavaDoc;
27 import com.sun.logging.LogDomains;
28
29 /**
30  * This class is a ConnectionEventListener for handling the "close" of a
31  * ManagedConnection that is not acquired through the appserver's pool.
32  * The ManagedConnection is simply destroyed after close is called
33  * Such an "unpooled" ManagedConnection is obtained for testConnectionPool
34  * and the ConnectorRuntime.getConnection() APIs
35  *
36  * @author Aditya Gore
37  * @since SJSAS 8.1
38  */

39 public class UnpooledConnectionEventListener implements ConnectionEventListener {
40     
41
42     static Logger JavaDoc _logger = LogDomains.getLogger(LogDomains.RSR_LOGGER);
43
44     public void connectionClosed(ConnectionEvent evt) {
45         ManagedConnection mc = (ManagedConnection) evt.getSource();
46     try {
47         mc.destroy();
48     } catch( Throwable JavaDoc re ) {
49          if (_logger.isLoggable(Level.FINE)) {
50              _logger.fine("error while closing testConnectionPool's mc");
51          }
52     }
53     if (_logger.isLoggable(Level.FINE)) {
54         _logger.fine("UnpooledConnectionEventListener: Connection closed");
55     }
56     }
57         
58     public void connectionErrorOccurred(ConnectionEvent evt) {
59         //no-op
60
}
61
62     public void localTransactionStarted(ConnectionEvent evt) {
63             // no-op
64
}
65
66     public void localTransactionCommitted(ConnectionEvent evt) {
67          // no-op
68
}
69
70     public void localTransactionRolledback(ConnectionEvent evt) {
71         // no-op
72
}
73
74 }
75
76
Popular Tags