Path: blob/master/src/java.naming/share/classes/javax/naming/event/NamingExceptionEvent.java
41159 views
/*1* Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.naming.event;2627import javax.naming.NamingException;2829/**30* This class represents an event fired when the procedures/processes31* used to collect information for notifying listeners of32* {@code NamingEvent}s threw a {@code NamingException}.33* This can happen, for example, if the server which the listener is using34* aborts subsequent to the {@code addNamingListener()} call.35*36* @author Rosanna Lee37* @author Scott Seligman38*39* @see NamingListener#namingExceptionThrown40* @see EventContext41* @since 1.342*/4344public class NamingExceptionEvent extends java.util.EventObject {45/**46* Contains the exception that was thrown47* @serial48*/49private NamingException exception;5051/**52* Constructs an instance of {@code NamingExceptionEvent} using53* the context in which the {@code NamingException} was thrown and the exception54* that was thrown.55*56* @param source The non-null context in which the exception was thrown.57* @param exc The non-null {@code NamingException} that was thrown.58*59*/60public NamingExceptionEvent(EventContext source, NamingException exc) {61super(source);62exception = exc;63}6465/**66* Retrieves the exception that was thrown.67* @return The exception that was thrown.68*/69public NamingException getException() {70return exception;71}7273/**74* Retrieves the {@code EventContext} that fired this event.75* This returns the same object as {@code EventObject.getSource()}.76* @return The non-null {@code EventContext} that fired this event.77*/78public EventContext getEventContext() {79return (EventContext)getSource();80}8182/**83* Invokes the {@code namingExceptionThrown()} method on84* a listener using this event.85* @param listener The non-null naming listener on which to invoke86* the method.87*/88public void dispatch(NamingListener listener) {89listener.namingExceptionThrown(this);90}9192private static final long serialVersionUID = -4877678086134736336L;93}949596