1. /*
  2. * @(#)ConnectionEventListener.java 1.8 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.sql;
  8. /**
  9. * <P>
  10. * An object that registers to be notified of events generated by a
  11. * <code>PooledConnection</code> object.
  12. * <P>
  13. * The <code>ConnectionEventListener</code> interface is implemented by a
  14. * connection pooling component. A connection pooling component will
  15. * usually be provided by a JDBC driver vendor or another system software
  16. * vendor. A JDBC driver notifies a <code>ConnectionEventListener</code>
  17. * object when an application is finished using a pooled connection with
  18. * which the listener has registered. The notification
  19. * occurs after the application calls the method <code>close</code> on
  20. * its representation of a <code>PooledConnection</code> object. A
  21. * <code>ConnectionEventListener</code> is also notified when a
  22. * connection error occurs due to the fact that the <code>PooledConnection</code>
  23. * is unfit for future use---the server has crashed, for example.
  24. * The listener is notified by the JDBC driver just before the driver throws an
  25. * <code>SQLException</code> to the application using the
  26. * <code>PooledConnection</code> object.
  27. *
  28. * @since 1.4
  29. */
  30. public interface ConnectionEventListener extends java.util.EventListener {
  31. /**
  32. * Notifies this <code>ConnectionEventListener</code> that
  33. * the application has called the method <code>close</code> on its
  34. * representation of a pooled connection.
  35. *
  36. * @param event an event object describing the source of
  37. * the event
  38. */
  39. void connectionClosed(ConnectionEvent event);
  40. /**
  41. * Notifies this <code>ConnectionEventListener</code> that
  42. * a fatal error has occurred and the pooled connection can
  43. * no longer be used. The driver makes this notification just
  44. * before it throws the application the <code>SQLException</code>
  45. * contained in the given <code>ConnectionEvent</code> object.
  46. *
  47. * @param event an event object describing the source of
  48. * the event and containing the <code>SQLException</code> that the
  49. * driver is about to throw
  50. */
  51. void connectionErrorOccurred(ConnectionEvent event);
  52. }