uTools-Manuals/docs/java/javax/management/NotificationEmitter.html

126 lines
9.9 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div class="header">
<div class="subTitle">
compact3
</div>
<div class="subTitle">
javax.management
</div>
<h2 class="title" title="Interface NotificationEmitter">Interface NotificationEmitter</h2>
</div><div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>
All Superinterfaces:
</dt>
<dd>
<span><a href="../../javax/management/NotificationBroadcaster.html" title="javax.management中的接口">NotificationBroadcaster</a></span>
</dd>
</dl>
<dl>
<dt>
所有已知实现类:
</dt>
<dd>
<span><a href="../../javax/management/monitor/CounterMonitor.html" title="javax.management.monitor中的类">CounterMonitor</a> <a href="../../javax/management/monitor/GaugeMonitor.html" title="javax.management.monitor中的类">GaugeMonitor</a> <a href="../../javax/management/remote/JMXConnectorServer.html" title="javax.management.remote中的类">JMXConnectorServer</a> <a href="../../javax/management/MBeanServerDelegate.html" title="javax.management中的类">MBeanServerDelegate</a> <a href="../../javax/management/monitor/Monitor.html" title="javax.management.monitor中的类">Monitor</a> <a href="../../javax/management/NotificationBroadcasterSupport.html" title="javax.management中的类">NotificationBroadcasterSupport</a> <a href="../../javax/management/relation/RelationService.html" title="javax.management.relation中的类">RelationService</a> <a href="../../javax/management/modelmbean/RequiredModelMBean.html" title="javax.management.modelmbean中的类">RequiredModelMBean</a> <a href="../../javax/management/remote/rmi/RMIConnectorServer.html" title="javax.management.remote.rmi中的类">RMIConnectorServer</a> <a href="../../javax/management/StandardEmitterMBean.html" title="javax.management中的类">StandardEmitterMBean</a> <a href="../../javax/management/monitor/StringMonitor.html" title="javax.management.monitor中的类">StringMonitor</a> <a href="../../javax/management/timer/Timer.html" title="javax.management.timer中的类">Timer</a></span>
</dd>
</dl>
<hr/> <br/> <pre>public interface <span class="typeNameLabel">NotificationEmitter</span>
extends <a href="../../javax/management/NotificationBroadcaster.html" title="interface in javax.management">NotificationBroadcaster</a></pre>
<div class="block">
<p> <span>由发出通知的MBean实现的接口。</span> <span>它允许监听器作为通知监听器注册到MBean。</span> </p>
<h3> <span>通知发送</span> </h3>
<p> <span>当MBean发出的通知则认为已被添加与每个听者<a href="../../javax/management/NotificationBroadcaster.html#addNotificationListener-javax.management.NotificationListener-javax.management.NotificationFilter-java.lang.Object-"><code>addNotificationListener</code></a>和随后不移除<a href="../../javax/management/NotificationEmitter.html#removeNotificationListener-javax.management.NotificationListener-javax.management.NotificationFilter-java.lang.Object-"><code>removeNotificationListener</code></a></span> <span>如果为该监听器提供过滤器,并且如果过滤器的<a href="../../javax/management/NotificationFilter.html#isNotificationEnabled-javax.management.Notification-"><code>isNotificationEnabled</code></a>方法返回false则忽略监听器。</span> <span>否则,通过<a href="../../javax/management/NotificationListener.html#handleNotification-javax.management.Notification-java.lang.Object-">通知</a>调用侦听器的<a href="../../javax/management/NotificationListener.html#handleNotification-javax.management.Notification-java.lang.Object-"><code>handleNotification</code></a>方法,以及提供给<code>addNotificationListener</code>对象。</span> </p>
<p> <span>如果同一个监听器被多次添加,它被认为是添加的次数。</span> <span>通过不同的过滤器或回传对象添加相同的监听器通常很有用。</span> </p>
<p> <span>关于调用过滤器和侦听器的方法的线程,此接口的实现可能会有所不同。</span> </p>
<p> <span>如果过滤器或侦听器的方法调用抛出<a href="../../java/lang/Exception.html" title="java.lang中的类"><code>异常</code></a> ,则该异常不应阻止其他侦听器被调用。</span> <span>但是,如果方法调用抛出一个<a href="../../java/lang/Error.html" title="java.lang中的类"><code>Error</code></a> 那么建议在该点处理通知停止如果可以将Error <code>Error</code>给通知的发件人,那么应该这样做。</span> </p>
<p> <span>该接口应该被新的代码使用,优先于<a href="../../javax/management/NotificationBroadcaster.html" title="javax.management中的接口"><code>NotificationBroadcaster</code></a>接口。</span> </p>
<p> <span>该接口和<code>NotificationBroadcaster</code>应该小心同步。</span> <span>特别地,实现该方法在调用监听器时保持任何锁定并不是一个好主意。</span> <span>要处理在发送通知时听众列表可能发生更改的可能性,一个好的策略是使用<a href="../../java/util/concurrent/CopyOnWriteArrayList.html" title="java.util.concurrent中的类"><code>CopyOnWriteArrayList</code></a>作为此列表。</span> </p>
</div>
<dl>
<dt>
<span class="simpleTagLabel">从以下版本开始:</span>
</dt>
<dd>
1.5
</dd>
</dl> </li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- --> </a> <h3>方法摘要</h3>
<table border="0" cellpadding="3" cellspacing="0" class="memberSummary" summary="Method Summary table, listing methods, and an explanation">
<caption>
<span class="activeTableTab" id="t0"><span>所有方法</span><span class="tabEnd"> </span></span>
<span class="tableTab" id="t2"><span><a href="javascript:show(2);">接口方法</a></span><span class="tabEnd"> </span></span>
<span class="tableTab" id="t3"><span><a href="javascript:show(4);">抽象方法</a></span><span class="tabEnd"> </span></span>
</caption>
<tbody>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor" id="i0">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/management/NotificationEmitter.html#removeNotificationListener-javax.management.NotificationListener-javax.management.NotificationFilter-java.lang.Object-">removeNotificationListener</a></span>(<a href="../../javax/management/NotificationListener.html" title="interface in javax.management">NotificationListener</a> listener, <a href="../../javax/management/NotificationFilter.html" title="interface in javax.management">NotificationFilter</a> filter, <a href="../../java/lang/Object.html" title="class in java.lang">Object</a> handback)</code>
<div class="block">
从这个MBean中删除一个监听器。
</div> </td>
</tr>
</tbody>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.javax.management.NotificationBroadcaster">
<!-- --> </a> <h3>Methods inherited from interface javax.management.<a href="../../javax/management/NotificationBroadcaster.html" title="interface in javax.management">NotificationBroadcaster</a></h3> <code><a href="../../javax/management/NotificationBroadcaster.html#addNotificationListener-javax.management.NotificationListener-javax.management.NotificationFilter-java.lang.Object-">addNotificationListener</a>, <a href="../../javax/management/NotificationBroadcaster.html#getNotificationInfo--">getNotificationInfo</a>, <a href="../../javax/management/NotificationBroadcaster.html#removeNotificationListener-javax.management.NotificationListener-">removeNotificationListener</a></code></li>
</ul> </li>
</ul> </li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- --> </a> <h3>方法详细信息</h3> <a name="removeNotificationListener-javax.management.NotificationListener-javax.management.NotificationFilter-java.lang.Object-">
<!-- --> </a>
<ul class="blockListLast">
<li class="blockList"> <h4>removeNotificationListener</h4> <pre>void removeNotificationListener(<a href="../../javax/management/NotificationListener.html" title="interface in javax.management">NotificationListener</a> listener,
<a href="../../javax/management/NotificationFilter.html" title="interface in javax.management">NotificationFilter</a> filter,
<a href="../../java/lang/Object.html" title="class in java.lang">Object</a> handback)
throws <a href="../../javax/management/ListenerNotFoundException.html" title="class in javax.management">ListenerNotFoundException</a></pre>
<div class="block">
<p> <span>从这个MBean中删除一个监听器。</span> <span>该MBean必须有一个与给定匹配的侦听<code>listener</code> <code>filter</code><code>handback</code>参数。</span> <span>如果有多个这样的听众,只有一个被删除。</span> </p>
<p> <span><code>filter</code><code>handback</code>参数可能为null当且仅当它们在要删除的侦听器中为空时。</span> </p>
</div>
<dl>
<dt>
<span class="paramLabel">参数</span>
</dt>
<dd>
<code>listener</code> - 以前添加到此MBean的侦听器。
</dd>
<dd>
<code>filter</code> - 添加侦听器时指定的过滤器。
</dd>
<dd>
<code>handback</code> - 添加侦听器时指定的回传。
</dd>
<dt>
<span class="throwsLabel">异常</span>
</dt>
<dd>
<code><a href="../../javax/management/ListenerNotFoundException.html" title="class in javax.management">ListenerNotFoundException</a></code> - 监听器未注册到MBean或者没有向给定的过滤器和回传注册。
</dd>
</dl> </li>
</ul> </li>
</ul> </li>
</ul>
</div>
</div>