Path: blob/aarch64-shenandoah-jdk8u272-b10/jaxws/src/share/jaxws_classes/javax/annotation/PreDestroy.java
38873 views
/*1* Copyright (c) 2005, 2013, 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.annotation;2627import java.lang.annotation.*;28import static java.lang.annotation.ElementType.*;29import static java.lang.annotation.RetentionPolicy.*;3031/**32* The PreDestroy annotation is used on methods as a callback notification to33* signal that the instance is in the process of being removed by the34* container. The method annotated with PreDestroy is typically used to35* release resources that it has been holding. This annotation MUST be36* supported by all container managed objects that support PostConstruct37* except the application client container in Java EE 5. The method on which38* the PreDestroy annotation is applied MUST fulfill all of the following39* criteria:40* <p>41* <ul>42* <li>The method MUST NOT have any parameters except in the case of43* interceptors in which case it takes an InvocationContext object as44* defined by the Interceptors specification.</li>45* <li>The method defined on an interceptor class MUST HAVE one of the46* following signatures:47* <p>48* void <METHOD>(InvocationContext)49* <p>50* Object <METHOD>(InvocationContext) throws Exception51* <p>52* <i>Note: A PreDestroy interceptor method must not throw application53* exceptions, but it may be declared to throw checked exceptions including54* the java.lang.Exception if the same interceptor method interposes on55* business or timeout methods in addition to lifecycle events. If a56* PreDestroy interceptor method returns a value, it is ignored by57* the container.</i>58* </li>59* <li>The method defined on a non-interceptor class MUST HAVE the60* following signature:61* <p>62* void <METHOD>()63* </li>64* <li>The method on which PreDestroy is applied MAY be public, protected,65* package private or private.</li>66* <li>The method MUST NOT be static.</li>67* <li>The method MAY be final.</li>68* <li>If the method throws an unchecked exception it is ignored except in the69* case of EJBs where the EJB can handle exceptions.</li>70* </ul>71*72* @see javax.annotation.PostConstruct73* @see javax.annotation.Resource74* @since Common Annotations 1.075*/7677@Documented78@Retention (RUNTIME)79@Target(METHOD)80public @interface PreDestroy {81}828384