jdk/src/share/classes/javax/sql/StatementEventListener.java
author yan
Wed, 30 Apr 2014 15:13:44 +0400
changeset 24197 a5c2cff81e25
parent 5506 202f599c92aa
permissions -rw-r--r--
8039488: Tidy warnings cleanup for javax.sql Reviewed-by: lancea Contributed-by: Alexander Stepanov <alexander.v.stepanov@oracle.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
24197
a5c2cff81e25 8039488: Tidy warnings cleanup for javax.sql
yan
parents: 5506
diff changeset
     2
 * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 * Created on Apr 28, 2005
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
package javax.sql;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * An object that registers to be notified of events that occur on PreparedStatements
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * that are in the Statement pool.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * The JDBC 3.0 specification added the maxStatements
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * <code>ConnectionPooledDataSource</code> property to provide a standard mechanism for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * enabling the pooling of <code>PreparedStatements</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * and to specify the size of the statement
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * pool.  However, there was no way for a driver to notify an external
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * statement pool when a <code>PreparedStatement</code> becomes invalid.  For some databases, a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * statement becomes invalid if a DDL operation is performed that affects the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * table.  For example an application may create a temporary table to do some work
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * on the table and then destroy it.  It may later recreate the same table when
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * it is needed again.  Some databases will invalidate any prepared statements
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * that reference the temporary table when the table is dropped.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * Similar to the methods defined in the <code>ConnectionEventListener</code> interface,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * the driver will call the <code>StatementEventListener.statementErrorOccurred</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * method prior to throwing any exceptions when it detects a statement is invalid.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * The driver will also call the <code>StatementEventListener.statementClosed</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * method when a <code>PreparedStatement</code> is closed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * Methods which allow a component to register a StatementEventListener with a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * <code>PooledConnection</code> have been added to the <code>PooledConnection</code> interface.
24197
a5c2cff81e25 8039488: Tidy warnings cleanup for javax.sql
yan
parents: 5506
diff changeset
    55
 *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
public interface StatementEventListener  extends java.util.EventListener{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
  /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
   * The driver calls this method on all <code>StatementEventListener</code>s registered on the connection when it detects that a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
   * <code>PreparedStatement</code> is closed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
   * @param event an event object describing the source of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
   * the event and that the <code>PreparedStatement</code> was closed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
   * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
  void statementClosed(StatementEvent event);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
         * The driver calls this method on all <code>StatementEventListener</code>s
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
         * registered on the connection when it detects that a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
         * <code>PreparedStatement</code> is invalid. The driver calls this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
         * just before it throws the <code>SQLException</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
         * contained in the given event, to the application.
24197
a5c2cff81e25 8039488: Tidy warnings cleanup for javax.sql
yan
parents: 5506
diff changeset
    75
         *
a5c2cff81e25 8039488: Tidy warnings cleanup for javax.sql
yan
parents: 5506
diff changeset
    76
         * @param event    an event object describing the source of the event,
a5c2cff81e25 8039488: Tidy warnings cleanup for javax.sql
yan
parents: 5506
diff changeset
    77
         *                 the statement that is invalid and the exception the
a5c2cff81e25 8039488: Tidy warnings cleanup for javax.sql
yan
parents: 5506
diff changeset
    78
         *                 driver is about to throw.  The source of the event is
a5c2cff81e25 8039488: Tidy warnings cleanup for javax.sql
yan
parents: 5506
diff changeset
    79
         *                 the <code>PooledConnection</code> which the invalid <code>PreparedStatement</code>
a5c2cff81e25 8039488: Tidy warnings cleanup for javax.sql
yan
parents: 5506
diff changeset
    80
         *                 is associated with.
a5c2cff81e25 8039488: Tidy warnings cleanup for javax.sql
yan
parents: 5506
diff changeset
    81
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
         * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        void statementErrorOccurred(StatementEvent event);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
}