KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mchange > v2 > c3p0 > ConnectionCustomizer


1 /*
2  * Distributed as part of c3p0 v.0.9.1
3  *
4  * Copyright (C) 2005 Machinery For Change, Inc.
5  *
6  * Author: Steve Waldman <swaldman@mchange.com>
7  *
8  * This library is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License version 2.1, as
10  * published by the Free Software Foundation.
11  *
12  * This software is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this software; see the file LICENSE. If not, write to the
19  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */

22
23
24 package com.mchange.v2.c3p0;
25
26 import java.sql.Connection JavaDoc;
27 import java.sql.SQLException JavaDoc;
28
29 /**
30  * <p>Implementations of this interface should
31  * be immutable, and should offer public,
32  * no argument constructors.</p>
33  *
34  * <p>The methods are handed raw, physical
35  * database Connections, not c3p0-generated
36  * proxies.</p>
37  *
38  * <p>Although c3p0 will ensure this with
39  * respect to state controlled by
40  * standard JDBC methods, any modifications
41  * of vendor-specific state shold be made
42  * consistently so that all Connections
43  * in the pool are interchangable.</p>
44  */

45 public interface ConnectionCustomizer
46 {
47     /**
48      * <p>Called immediately after a
49      * Connection is acquired from the
50      * underlying database for
51      * incorporation into the pool.</p>
52      *
53      * <p>This method is only called once
54      * per Connection. If standard JDBC
55      * Connection properties are modified
56      * [holdability, transactionIsolation,
57      * readOnly], those modifications
58      * will override defaults throughout
59      * the Connection's tenure in the
60      * pool.</p>
61      */

62     public void onAcquire( Connection JavaDoc c, String JavaDoc parentDataSourceIdentityToken )
63     throws Exception JavaDoc;
64
65     /**
66      * Called immediately before a
67      * Connection is destroyed after
68      * being removed from the pool.
69      */

70     public void onDestroy( Connection JavaDoc c, String JavaDoc parentDataSourceIdentityToken )
71     throws Exception JavaDoc;
72
73     /**
74      * Called immediately before a
75      * Connection is made available to
76      * a client upon checkout.
77      */

78     public void onCheckOut( Connection JavaDoc c, String JavaDoc parentDataSourceIdentityToken )
79     throws Exception JavaDoc;
80
81     /**
82      * Called immediately after a
83      * Connection is checked in,
84      * prior to reincorporation
85      * into the pool.
86      */

87     public void onCheckIn( Connection JavaDoc c, String JavaDoc parentDataSourceIdentityToken )
88     throws Exception JavaDoc;
89 }
90
Popular Tags