author | naoto |
Tue, 12 Nov 2019 14:05:18 -0800 | |
changeset 59043 | 1a79b4bfc85a |
parent 58338 | faf791c5a710 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
58338
faf791c5a710
8231442: Suppress warnings on non-serializable instance fields in java.sql.* modules
darcy
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
/* |
|
27 |
* Created on Apr 28, 2005 |
|
28 |
*/ |
|
29 |
package javax.sql; |
|
30 |
||
31 |
import java.sql.PreparedStatement; |
|
32 |
import java.sql.SQLException; |
|
33 |
import java.util.EventObject; |
|
34 |
||
35 |
/** |
|
36 |
* A <code>StatementEvent</code> is sent to all <code>StatementEventListener</code>s which were |
|
37 |
* registered with a <code>PooledConnection</code>. This occurs when the driver determines that a |
|
38 |
* <code>PreparedStatement</code> that is associated with the <code>PooledConnection</code> has been closed or the driver determines |
|
39 |
* is invalid. |
|
24197 | 40 |
* |
2 | 41 |
* @since 1.6 |
42 |
*/ |
|
43 |
public class StatementEvent extends EventObject { |
|
44 |
||
11129
f9ad1aadf3fa
7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents:
5506
diff
changeset
|
45 |
static final long serialVersionUID = -8089573731826608315L; |
2 | 46 |
private SQLException exception; |
58338
faf791c5a710
8231442: Suppress warnings on non-serializable instance fields in java.sql.* modules
darcy
parents:
47216
diff
changeset
|
47 |
@SuppressWarnings("serial") // Not statically typed as Serializable |
2 | 48 |
private PreparedStatement statement; |
49 |
||
50 |
/** |
|
51 |
* Constructs a <code>StatementEvent</code> with the specified <code>PooledConnection</code> and |
|
52 |
* <code>PreparedStatement</code>. The <code>SQLException</code> contained in the event defaults to |
|
53 |
* null. |
|
24197 | 54 |
* |
2 | 55 |
* @param con The <code>PooledConnection</code> that the closed or invalid |
56 |
* <code>PreparedStatement</code>is associated with. |
|
21278 | 57 |
* @param statement The <code>PreparedStatement</code> that is being closed or is invalid |
24197 | 58 |
* |
2 | 59 |
* @throws IllegalArgumentException if <code>con</code> is null. |
60 |
* |
|
61 |
* @since 1.6 |
|
62 |
*/ |
|
63 |
public StatementEvent(PooledConnection con, |
|
64 |
PreparedStatement statement) { |
|
65 |
||
66 |
super(con); |
|
67 |
||
68 |
this.statement = statement; |
|
69 |
this.exception = null; |
|
70 |
} |
|
71 |
||
72 |
/** |
|
73 |
* Constructs a <code>StatementEvent</code> with the specified <code>PooledConnection</code>, |
|
74 |
* <code>PreparedStatement</code> and <code>SQLException</code> |
|
24197 | 75 |
* |
2 | 76 |
* @param con The <code>PooledConnection</code> that the closed or invalid <code>PreparedStatement</code> |
77 |
* is associated with. |
|
78 |
* @param statement The <code>PreparedStatement</code> that is being closed or is invalid |
|
79 |
* @param exception The <code>SQLException </code>the driver is about to throw to |
|
80 |
* the application |
|
81 |
* |
|
82 |
* @throws IllegalArgumentException if <code>con</code> is null. |
|
24197 | 83 |
* |
2 | 84 |
* @since 1.6 |
85 |
*/ |
|
86 |
public StatementEvent(PooledConnection con, |
|
87 |
PreparedStatement statement, |
|
88 |
SQLException exception) { |
|
89 |
||
90 |
super(con); |
|
91 |
||
92 |
this.statement = statement; |
|
93 |
this.exception = exception; |
|
94 |
} |
|
95 |
||
96 |
/** |
|
97 |
* Returns the <code>PreparedStatement</code> that is being closed or is invalid |
|
24197 | 98 |
* |
2 | 99 |
* @return The <code>PreparedStatement</code> that is being closed or is invalid |
24197 | 100 |
* |
2 | 101 |
* @since 1.6 |
102 |
*/ |
|
103 |
public PreparedStatement getStatement() { |
|
104 |
||
105 |
return this.statement; |
|
106 |
} |
|
107 |
||
108 |
/** |
|
109 |
* Returns the <code>SQLException</code> the driver is about to throw |
|
24197 | 110 |
* |
2 | 111 |
* @return The <code>SQLException</code> the driver is about to throw |
24197 | 112 |
* |
2 | 113 |
* @since 1.6 |
114 |
*/ |
|
115 |
public SQLException getSQLException() { |
|
116 |
||
117 |
return this.exception; |
|
118 |
} |
|
119 |
} |