⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 eventcontext.html

📁 API資料大全
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Thu Apr 27 23:37:37 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Interface  EventContext</TITLE><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"></HEAD><BODY BGCOLOR="white"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">  <TR ALIGN="center" VALIGN="top">  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/EventContext.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup>&nbsp;2&nbsp;Platform<br>Std.&nbsp;Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;PREV CLASS&nbsp;&nbsp;<A HREF="../../../javax/naming/event/EventDirContext.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">  <A HREF="../../../index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;&nbsp;<A HREF="EventContext.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: &nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">javax.naming.event</FONT><BR>Interface  EventContext</H2><DL><DT><B>All Superinterfaces:</B> <DD><A HREF="../../../javax/naming/Context.html">Context</A></DD></DL><DL><DT><B>All Known Subinterfaces:</B> <DD><A HREF="../../../javax/naming/event/EventDirContext.html">EventDirContext</A></DD></DL><HR><DL><DT>public interface <B>EventContext</B><DT>extends <A HREF="../../../javax/naming/Context.html">Context</A></DL><P>Contains methods for registering/deregistering listeners to be notified of events fired when objects named in a context changes.<p><h4>Target</h4> The name parameter in the <tt>addNamingListener()</tt> methods is referred to as the <em>target</tt>. The target, along with the scope, identify the object(s) that the listener is interested in. It is possible to register interest in a target that does not exist, but there might be limitations in the extent to which this can be supported by the service provider and underlying protocol/service. <p> If a service only supports registration for existing targets, an attempt to register for a nonexistent target results in a <tt>NameNotFoundException</tt> being thrown as early as possible, preferrably at the time <tt>addNamingListener()</tt> is called, or if that is not possible, the listener will receive the exception through the  <tt>NamingExceptionEvent</tt>.<p> Also, for service providers that only support registration for existing targets, when the target that a listener has registered for is subsequently removed from the namespace, the listener is notified via a <tt>NamingExceptionEvent</tt> (containing a <tt>NameNotFoundException</tt>).<p> An application can use the method <tt>targetMustExist()</tt> to check whether a <tt>EventContext</tt> supports registration of nonexistent targets.<p><h4>Event Source</h4> The <tt>EventContext</tt> instance on which you invoke the  registration methods is the <em>event source</em> of the events that are (potentially) generated.  The source is <em>not necessarily</em> the object named by the target. Only when the target is the empty name is the object named by the target  the source.  In other words, the target, along with the scope parameter, are used to identify the object(s) that the listener is interested in, but the event source is the <tt>EventContext</tt> instance with which the listener  has registered.<p> For example, suppose a listener makes the following registration:<blockquote><pre>	NamespaceChangeListener listener = ...;	src.addNamingListener("x", SUBTREE_SCOPE, listener);</pre></blockquote> When an object named "x/y" is subsequently deleted, the corresponding <tt>NamingEvent</tt> (<tt>evt</tt>)  must contain:<blockquote><pre>	evt.getEventContext() == src	evt.getOldBinding().getName().equals("x/y")</pre></blockquote><p> Furthermore, listener registration/deregistration is with  the <tt>EventContext</tt> <em>instance</em>, and not with the corresponding object in the namespace. If the program intends at some point to remove a listener, then it needs to  keep a reference to the <tt>EventContext</tt> instance on  which it invoked <tt>addNamingListener()</tt> (just as it needs to keep a reference to the listener in order to remove it later). It cannot expect to do a <tt>lookup()</tt> and get another instance of a <tt>EventContext</tt> on which to perform the deregistration.<h4>Lifetime of Registration</h4> A registered listener becomes deregistered when:<ul><li>It is removed using <tt>removeNamingListener()</tt>.<li>An exception is thrown while collecting information about the events.  That is, when the listener receives a <tt>NamingExceptionEvent</tt>.<li><tt>Context.close()</tt> is invoked on the <tt>EventContext</tt>  instance with which it has registered.</ul> Until that point, a <tt>EventContext</tt> instance that has outstanding listeners will continue to exist and be maintained by the service provider.<h4>Listener Implementations</h4> The registration/deregistration methods accept an instance of <tt>NamingListener</tt>. There are subinterfaces of <tt>NamingListener</tt> for different of event types of <tt>NamingEvent</tt>.  For example, the <tt>ObjectChangeListener</tt> interface is for the <tt>NamingEvent.OBJECT_CHANGED</tt> event type. To register interest in multiple event types, the listener implementation should implement multiple <tt>NamingListener</tt> subinterfaces and use a single invocation of <tt>addNamingListener()</tt>. In addition to reducing the number of method calls and possibly the code size of the listeners, this allows some service providers to optimize the registration.<h4>Threading Issues</h4> Like <tt>Context</tt> instances in general, instances of <tt>EventContext</tt> are not guaranteed to be thread-safe. Care must be taken when multiple threads are accessing the same <tt>EventContext</tt> concurrently. See the <a href=package-summary.html#THREADING>package description</a> for more information on threading issues.<P><DL><DT><B>Since: </B><DD>1.3</DD></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><A NAME="field_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Field Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/naming/event/EventContext.html#OBJECT_SCOPE">OBJECT_SCOPE</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constant for expressing interest in events concerning the object named  by the target.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/naming/event/EventContext.html#ONELEVEL_SCOPE">ONELEVEL_SCOPE</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constant for expressing interest in events concerning objects  in the context named by the target,  excluding the context named by the target.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/naming/event/EventContext.html#SUBTREE_SCOPE">SUBTREE_SCOPE</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constant for expressing interest in events concerning objects  in the subtree of the object named by the target, including the object named by the target.</TD></TR></TABLE>&nbsp;<A NAME="fields_inherited_from_class_javax.naming.Context"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Fields inherited from interface javax.naming.<A HREF="../../../javax/naming/Context.html">Context</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../../javax/naming/Context.html#APPLET">APPLET</A>, <A HREF="../../../javax/naming/Context.html#AUTHORITATIVE">AUTHORITATIVE</A>, <A HREF="../../../javax/naming/Context.html#BATCHSIZE">BATCHSIZE</A>, <A HREF="../../../javax/naming/Context.html#DNS_URL">DNS_URL</A>, <A HREF="../../../javax/naming/Context.html#INITIAL_CONTEXT_FACTORY">INITIAL_CONTEXT_FACTORY</A>, <A HREF="../../../javax/naming/Context.html#LANGUAGE">LANGUAGE</A>, <A HREF="../../../javax/naming/Context.html#OBJECT_FACTORIES">OBJECT_FACTORIES</A>, <A HREF="../../../javax/naming/Context.html#PROVIDER_URL">PROVIDER_URL</A>, <A HREF="../../../javax/naming/Context.html#REFERRAL">REFERRAL</A>, <A HREF="../../../javax/naming/Context.html#SECURITY_AUTHENTICATION">SECURITY_AUTHENTICATION</A>, <A HREF="../../../javax/naming/Context.html#SECURITY_CREDENTIALS">SECURITY_CREDENTIALS</A>, <A HREF="../../../javax/naming/Context.html#SECURITY_PRINCIPAL">SECURITY_PRINCIPAL</A>, <A HREF="../../../javax/naming/Context.html#SECURITY_PROTOCOL">SECURITY_PROTOCOL</A>, <A HREF="../../../javax/naming/Context.html#STATE_FACTORIES">STATE_FACTORIES</A>, <A HREF="../../../javax/naming/Context.html#URL_PKG_PREFIXES">URL_PKG_PREFIXES</A></CODE></TD></TR></TABLE>&nbsp;<!-- ======== CONSTRUCTOR SUMMARY ======== --><!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/naming/event/EventContext.html#addNamingListener(javax.naming.Name, int, javax.naming.event.NamingListener)">addNamingListener</A></B>(<A HREF="../../../javax/naming/Name.html">Name</A>&nbsp;target,                  int&nbsp;scope,                  <A HREF="../../../javax/naming/event/NamingListener.html">NamingListener</A>&nbsp;l)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds a listener for receiving naming events fired when the object(s) identified by a target and scope changes.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/naming/event/EventContext.html#addNamingListener(java.lang.String, int, javax.naming.event.NamingListener)">addNamingListener</A></B>(<A HREF="../../../java/lang/String.html">String</A>&nbsp;target,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -