KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > sql > ConnectionEvent


1 /*
2  * @(#)ConnectionEvent.java 1.9 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.sql;
9
10 import java.sql.SQLException JavaDoc;
11
12 /**
13  * <P>An <code>Event</code> object that provides information about the
14  * source of a connection-related event. <code>ConnectionEvent</code>
15  * objects are generated when an application closes a pooled connection
16  * and when an error occurs. The <code>ConnectionEvent</code> object
17  * contains two kinds of information:
18  * <UL>
19  * <LI>The pooled connection closed by the application
20  * <LI>In the case of an error event, the <code>SQLException</code>
21  * about to be thrown to the application
22  * </UL>
23  *
24  * @since 1.4
25  */

26
27 public class ConnectionEvent extends java.util.EventObject JavaDoc {
28
29   /**
30    * <P>Constructs a <code>ConnectionEvent</code> object initialized with
31    * the given <code>PooledConnection</code> object. <code>SQLException</code>
32    * defaults to <code>null</code>.
33    *
34    * @param con the pooled connection that is the source of the event
35    */

36   public ConnectionEvent(PooledConnection JavaDoc con) {
37     super(con);
38   }
39
40   /**
41    * <P>Constructs a <code>ConnectionEvent</code> object initialized with
42    * the given <code>PooledConnection</code> object and
43    * <code>SQLException</code> object.
44    *
45    * @param con the pooled connection that is the source of the event
46    * @param ex the SQLException about to be thrown to the application
47    */

48   public ConnectionEvent(PooledConnection JavaDoc con, SQLException JavaDoc ex) {
49     super(con);
50     this.ex = ex;
51   }
52  
53   /**
54    * <P>Retrieves the <code>SQLException</code> for this
55    * <code>ConnectionEvent</code> object. May be <code>null</code>.
56    *
57    * @return the SQLException about to be thrown or <code>null</code>
58    */

59   public SQLException JavaDoc getSQLException() { return ex; }
60
61   /**
62    * The <code>SQLException</code> that the driver will throw to the
63    * application when an error occurs and the pooled connection is no
64    * longer usable.
65    * @serial
66    */

67   private SQLException JavaDoc ex = null;
68
69   /**
70    * Private serial version unique ID to ensure serialization
71    * compatibility.
72    */

73   static final long serialVersionUID = -4843217645290030002L;
74
75  }
76
77
78
79
80
81
Popular Tags