1 /*
   2  * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   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
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  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  *
  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.
  24  */
  25 
  26 package java.sql;
  27 
  28 /**
  29  * An interface that must be implemented when a {@linkplain Driver} wants to be
  30  * notified by {@code DriverManager}.  
  31  *<P>
  32  * A {@code DriverAction} implementation is not intended to be used
  33  * directly by applications. A JDBC Driver  may choose
  34  * to create its {@code DriverAction} implementation in a private class
  35  * to avoid it being called directly.
  36  * <o>
  37  * The JDBC driver's static initialization block must call
  38  * {@linkplain DriverManager#registerDriver(Driver, DriverAction) } in order
  39  * to inform {@code DriverManager} which {@code DriverAction} implementation to
  40  * call when the JDBC driver is de-registered.
  41  * @since 1.8
  42  */
  43 public interface DriverAction {
  44     /**
  45      * Method called by 
  46      * {@linkplain DriverManager#deregisterDriver(Driver) }
  47      *  to notify the JDBC driver that it was de-registered.
  48      * <p> 
  49      * The {@code deregister} method is intended only to be used by JDBC Drivers
  50      * and not by applications.  JDBC drivers are recommended to not implement
  51      * {@code DriverAction} in a public class.  If there are active
  52      * connections to the database at the time that the {@code deregister}
  53      * method is called, it is implementation specific as to whether the
  54      * connections are closed or allowed to continue. Once this method is
  55      * called, it is implementation specific as to whether the driver may
  56      * limit the ability to create new connections to the database, invoke
  57      * other {@code Driver} methods or throw a {@code SQLException}.
  58      * Consult your JDBC driver's documentation for additional information
  59      * on its behavior.
  60      * @see DriverManager#registerDriver(Driver, DriverAction)
  61      * @see DriverManager#deregisterDriver(Driver)
  62      * @since 1.8
  63      */
  64     void deregister();
  65     
  66 }