author | darcy |
Thu, 01 Nov 2018 20:37:45 -0700 | |
changeset 52380 | 6b31efbf833e |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
17199
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
1 |
/* |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
2 |
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
4 |
* |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
10 |
* |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
15 |
* accompanied this code). |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
16 |
* |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
20 |
* |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
23 |
* questions. |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
24 |
*/ |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
25 |
|
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
26 |
package java.sql; |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
27 |
|
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
28 |
/** |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
29 |
* An interface that must be implemented when a {@linkplain Driver} wants to be |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
30 |
* notified by {@code DriverManager}. |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
31 |
*<P> |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
32 |
* A {@code DriverAction} implementation is not intended to be used |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
33 |
* directly by applications. A JDBC Driver may choose |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
34 |
* to create its {@code DriverAction} implementation in a private class |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
35 |
* to avoid it being called directly. |
18564 | 36 |
* <p> |
17199
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
37 |
* The JDBC driver's static initialization block must call |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
38 |
* {@linkplain DriverManager#registerDriver(java.sql.Driver, java.sql.DriverAction) } in order |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
39 |
* to inform {@code DriverManager} which {@code DriverAction} implementation to |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
40 |
* call when the JDBC driver is de-registered. |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
41 |
* @since 1.8 |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
42 |
*/ |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
43 |
public interface DriverAction { |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
44 |
/** |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
45 |
* Method called by |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
46 |
* {@linkplain DriverManager#deregisterDriver(Driver) } |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
47 |
* to notify the JDBC driver that it was de-registered. |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
48 |
* <p> |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
49 |
* The {@code deregister} method is intended only to be used by JDBC Drivers |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
50 |
* and not by applications. JDBC drivers are recommended to not implement |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
51 |
* {@code DriverAction} in a public class. If there are active |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
52 |
* connections to the database at the time that the {@code deregister} |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
53 |
* method is called, it is implementation specific as to whether the |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
54 |
* connections are closed or allowed to continue. Once this method is |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
55 |
* called, it is implementation specific as to whether the driver may |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
56 |
* limit the ability to create new connections to the database, invoke |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
57 |
* other {@code Driver} methods or throw a {@code SQLException}. |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
58 |
* Consult your JDBC driver's documentation for additional information |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
59 |
* on its behavior. |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
60 |
* @see DriverManager#registerDriver(java.sql.Driver, java.sql.DriverAction) |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
61 |
* @see DriverManager#deregisterDriver(Driver) |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
62 |
* @since 1.8 |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
63 |
*/ |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
64 |
void deregister(); |
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
65 |
|
28853592ce2b
8010416: Add a way for java.sql.Driver to be notified when it is deregistered
lancea
parents:
diff
changeset
|
66 |
} |