src/java.naming/share/classes/javax/naming/event/EventContext.java
author phh
Sat, 30 Nov 2019 14:33:05 -0800
changeset 59330 5b96c12f909d
parent 54126 478f1483c511
permissions -rw-r--r--
8234541: C1 emits an empty message when it inlines successfully Summary: Use "inline" as the message when successfull Reviewed-by: thartmann, mdoerr Contributed-by: navy.xliu@gmail.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
54126
478f1483c511 8220252: Fix Headings in java.naming
lancea
parents: 47216
diff changeset
     2
 * Copyright (c) 1999, 2019, 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
package javax.naming.event;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import javax.naming.Name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import javax.naming.Context;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import javax.naming.NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * Contains methods for registering/deregistering listeners to be notified of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * events fired when objects named in a context changes.
21285
e740104a04f1 8026840: Fix new doclint issues in javax.naming
darcy
parents: 18580
diff changeset
    36
 *
54126
478f1483c511 8220252: Fix Headings in java.naming
lancea
parents: 47216
diff changeset
    37
 *<h2>Target</h2>
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    38
 * The name parameter in the {@code addNamingListener()} methods is referred
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * to as the <em>target</em>. The target, along with the scope, identify
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * the object(s) that the listener is interested in.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * It is possible to register interest in a target that does not exist, but
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * there might be limitations in the extent to which this can be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * supported by the service provider and underlying protocol/service.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * If a service only supports registration for existing
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * targets, an attempt to register for a nonexistent target
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    47
 * results in a {@code NameNotFoundException} being thrown as early as possible,
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    48
 * preferably at the time {@code addNamingListener()} is called, or if that is
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * not possible, the listener will receive the exception through the
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    50
 * {@code NamingExceptionEvent}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * Also, for service providers that only support registration for existing
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * targets, when the target that a listener has registered for is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * subsequently removed from the namespace, the listener is notified
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    55
 * via a {@code NamingExceptionEvent} (containing a
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    56
 *{@code NameNotFoundException}).
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 *<p>
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    58
 * An application can use the method {@code targetMustExist()} to check
37880
60ec48925dc6 8156661: Handful of typos in javadoc
igerasim
parents: 32029
diff changeset
    59
 * whether an {@code EventContext} supports registration
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * of nonexistent targets.
21285
e740104a04f1 8026840: Fix new doclint issues in javax.naming
darcy
parents: 18580
diff changeset
    61
 *
54126
478f1483c511 8220252: Fix Headings in java.naming
lancea
parents: 47216
diff changeset
    62
 *<h2>Event Source</h2>
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    63
 * The {@code EventContext} instance on which you invoke the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * registration methods is the <em>event source</em> of the events that are
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * (potentially) generated.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * The source is <em>not necessarily</em> the object named by the target.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * Only when the target is the empty name is the object named by the target
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * the source.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 * In other words, the target,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 * along with the scope parameter, are used to identify
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 * the object(s) that the listener is interested in, but the event source
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    72
 * is the {@code EventContext} instance with which the listener
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 * has registered.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * For example, suppose a listener makes the following registration:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 *<blockquote><pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 *      NamespaceChangeListener listener = ...;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 *      src.addNamingListener("x", SUBTREE_SCOPE, listener);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 *</pre></blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 * When an object named "x/y" is subsequently deleted, the corresponding
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    81
 * {@code NamingEvent} ({@code evt})  must contain:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 *<blockquote><pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 *      evt.getEventContext() == src
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 *      evt.getOldBinding().getName().equals("x/y")
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 *</pre></blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 * Furthermore, listener registration/deregistration is with
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    88
 * the {@code EventContext}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 * <em>instance</em>, and not with the corresponding object in the namespace.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 * If the program intends at some point to remove a listener, then it needs to
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    91
 * keep a reference to the {@code EventContext} instance on
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    92
 * which it invoked {@code addNamingListener()} (just as
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
 * it needs to keep a reference to the listener in order to remove it
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    94
 * later). It cannot expect to do a {@code lookup()} and get another instance of
37880
60ec48925dc6 8156661: Handful of typos in javadoc
igerasim
parents: 32029
diff changeset
    95
 * an {@code EventContext} on which to perform the deregistration.
54126
478f1483c511 8220252: Fix Headings in java.naming
lancea
parents: 47216
diff changeset
    96
 *<h2>Lifetime of Registration</h2>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
 * A registered listener becomes deregistered when:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
 *<ul>
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    99
 *<li>It is removed using {@code removeNamingListener()}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
 *<li>An exception is thrown while collecting information about the events.
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   101
 *  That is, when the listener receives a {@code NamingExceptionEvent}.
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   102
 *<li>{@code Context.close()} is invoked on the {@code EventContext}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
 * instance with which it has registered.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
 </ul>
37880
60ec48925dc6 8156661: Handful of typos in javadoc
igerasim
parents: 32029
diff changeset
   105
 * Until that point, an {@code EventContext} instance that has outstanding
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
 * listeners will continue to exist and be maintained by the service provider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
 *
54126
478f1483c511 8220252: Fix Headings in java.naming
lancea
parents: 47216
diff changeset
   108
 *<h2>Listener Implementations</h2>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
 * The registration/deregistration methods accept an instance of
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   110
 * {@code NamingListener}. There are subinterfaces of {@code NamingListener}
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   111
 * for different of event types of {@code NamingEvent}.
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   112
 * For example, the {@code ObjectChangeListener}
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   113
 * interface is for the {@code NamingEvent.OBJECT_CHANGED} event type.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
 * To register interest in multiple event types, the listener implementation
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   115
 * should implement multiple {@code NamingListener} subinterfaces and use a
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   116
 * single invocation of {@code addNamingListener()}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
 * In addition to reducing the number of method calls and possibly the code size
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
 * of the listeners, this allows some service providers to optimize the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
 * registration.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
 *
54126
478f1483c511 8220252: Fix Headings in java.naming
lancea
parents: 47216
diff changeset
   121
 *<h2>Threading Issues</h2>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
 *
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   123
 * Like {@code Context} instances in general, instances of
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   124
 * {@code EventContext} are not guaranteed to be thread-safe.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
 * Care must be taken when multiple threads are accessing the same
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   126
 * {@code EventContext} concurrently.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
 * See the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
 * <a href=package-summary.html#THREADING>package description</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
 * for more information on threading issues.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
 * @author Rosanna Lee
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
 * @author Scott Seligman
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
 * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
public interface EventContext extends Context {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * Constant for expressing interest in events concerning the object named
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     * by the target.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     *<p>
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   141
     * The value of this constant is {@code 0}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    public final static int OBJECT_SCOPE = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     * Constant for expressing interest in events concerning objects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     * in the context named by the target,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     * excluding the context named by the target.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     *<p>
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   150
     * The value of this constant is {@code 1}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    public final static int ONELEVEL_SCOPE = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * Constant for expressing interest in events concerning objects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * in the subtree of the object named by the target, including the object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     * named by the target.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     *<p>
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   159
     * The value of this constant is {@code 2}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    public final static int SUBTREE_SCOPE = 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * Adds a listener for receiving naming events fired
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     * when the object(s) identified by a target and scope changes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * The event source of those events is this context. See the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     * class description for a discussion on event source and target.
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   170
     * See the descriptions of the constants {@code OBJECT_SCOPE},
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   171
     * {@code ONELEVEL_SCOPE}, and {@code SUBTREE_SCOPE} to see how
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   172
     * {@code scope} affects the registration.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     *<p>
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   174
     * {@code target} needs to name a context only when {@code scope} is
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   175
     * {@code ONELEVEL_SCOPE}.
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   176
     * {@code target} may name a non-context if {@code scope} is either
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   177
     * {@code OBJECT_SCOPE} or {@code SUBTREE_SCOPE}.  Using
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   178
     * {@code SUBTREE_SCOPE} for a non-context might be useful,
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   179
     * for example, if the caller does not know in advance whether {@code target}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     * is a context and just wants to register interest in the (possibly
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   181
     * degenerate subtree) rooted at {@code target}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     * When the listener is notified of an event, the listener may
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     * in invoked in a thread other than the one in which
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   185
     * {@code addNamingListener()} is executed.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     * Care must be taken when multiple threads are accessing the same
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   187
     * {@code EventContext} concurrently.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     * See the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     * <a href=package-summary.html#THREADING>package description</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * for more information on threading issues.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * @param target A nonnull name to be resolved relative to this context.
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   193
     * @param scope One of {@code OBJECT_SCOPE}, {@code ONELEVEL_SCOPE}, or
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   194
     * {@code SUBTREE_SCOPE}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     * @param l  The nonnull listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     * @exception NamingException If a problem was encountered while
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * adding the listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * @see #removeNamingListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    void addNamingListener(Name target, int scope, NamingListener l)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
        throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     * Adds a listener for receiving naming events fired
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     * when the object named by the string target name and scope changes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     *
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   207
     * See the overload that accepts a {@code Name} for details.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     * @param target The nonnull string name of the object resolved relative
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * to this context.
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   211
     * @param scope One of {@code OBJECT_SCOPE}, {@code ONELEVEL_SCOPE}, or
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   212
     * {@code SUBTREE_SCOPE}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * @param l  The nonnull listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * @exception NamingException If a problem was encountered while
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * adding the listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * @see #removeNamingListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    void addNamingListener(String target, int scope, NamingListener l)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
        throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * Removes a listener from receiving naming events fired
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   223
     * by this {@code EventContext}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     * The listener may have registered more than once with this
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   225
     * {@code EventContext}, perhaps with different target/scope arguments.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     * After this method is invoked, the listener will no longer
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   227
     * receive events with this {@code EventContext} instance
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     * as the event source (except for those events already in the process of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     * being dispatched).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     * If the listener was not, or is no longer, registered with
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   231
     * this {@code EventContext} instance, this method does not do anything.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * @param l  The nonnull listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     * @exception NamingException If a problem was encountered while
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     * removing the listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     * @see #addNamingListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
    void removeNamingListener(NamingListener l) throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     * Determines whether a listener can register interest in a target
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     * that does not exist.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     * @return true if the target must exist; false if the target need not exist.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     * @exception NamingException If the context's behavior in this regard cannot
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     * be determined.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    boolean targetMustExist() throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
}