本文整理汇总了Java中javax.management.remote.NotificationResult类的典型用法代码示例。如果您正苦于以下问题:Java NotificationResult类的具体用法?Java NotificationResult怎么用?Java NotificationResult使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NotificationResult类属于javax.management.remote包,在下文中一共展示了NotificationResult类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: snoopOnUnregister
import javax.management.remote.NotificationResult; //导入依赖的package包/类
private void snoopOnUnregister(NotificationResult nr) {
Set<IdAndFilter> delegateSet = listenerMap.get(MBeanServerDelegate.DELEGATE_NAME);
if (delegateSet == null || delegateSet.isEmpty()) {
return;
}
for (TargetedNotification tn : nr.getTargetedNotifications()) {
Integer id = tn.getListenerID();
for (IdAndFilter idaf : delegateSet) {
if (idaf.id == id) {
// This is a notification from the MBeanServerDelegate.
Notification n = tn.getNotification();
if (n instanceof MBeanServerNotification &&
n.getType().equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION)) {
MBeanServerNotification mbsn = (MBeanServerNotification) n;
ObjectName gone = mbsn.getMBeanName();
synchronized (listenerMap) {
listenerMap.remove(gone);
}
}
}
}
}
}
示例2: fetchNotifs
import javax.management.remote.NotificationResult; //导入依赖的package包/类
private NotificationResult fetchNotifs() {
try {
NotificationResult nr = ClientNotifForwarder.this.
fetchNotifs(clientSequenceNumber,maxNotifications,
timeout);
if (logger.traceOn()) {
logger.trace("NotifFetcher-run",
"Got notifications from the server: "+nr);
}
return nr;
} catch (ClassNotFoundException | NotSerializableException | UnmarshalException e) {
logger.trace("NotifFetcher.fetchNotifs", e);
return fetchOneNotif();
} catch (IOException ioe) {
if (!shouldStop()) {
logger.error("NotifFetcher-run",
"Failed to fetch notification, " +
"stopping thread. Error is: " + ioe, ioe);
logger.debug("NotifFetcher-run",ioe);
}
// no more fetching
return null;
}
}
示例3: snoopOnUnregister
import javax.management.remote.NotificationResult; //导入依赖的package包/类
private void snoopOnUnregister(NotificationResult nr) {
List<IdAndFilter> copy = null;
synchronized (listenerMap) {
Set<IdAndFilter> delegateSet = listenerMap.get(MBeanServerDelegate.DELEGATE_NAME);
if (delegateSet == null || delegateSet.isEmpty()) {
return;
}
copy = new ArrayList<>(delegateSet);
}
for (TargetedNotification tn : nr.getTargetedNotifications()) {
Integer id = tn.getListenerID();
for (IdAndFilter idaf : copy) {
if (idaf.id == id) {
// This is a notification from the MBeanServerDelegate.
Notification n = tn.getNotification();
if (n instanceof MBeanServerNotification &&
n.getType().equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION)) {
MBeanServerNotification mbsn = (MBeanServerNotification) n;
ObjectName gone = mbsn.getMBeanName();
synchronized (listenerMap) {
listenerMap.remove(gone);
}
}
}
}
}
}
示例4: fetchNotifications
import javax.management.remote.NotificationResult; //导入依赖的package包/类
public NotificationResult
fetchNotifications(NotificationBufferFilter filter,
long startSequenceNumber,
long timeout,
int maxNotifications)
throws InterruptedException {
NotificationBuffer buf = ArrayNotificationBuffer.this;
return buf.fetchNotifications(filter, startSequenceNumber,
timeout, maxNotifications);
}
示例5: fetchNotifications
import javax.management.remote.NotificationResult; //导入依赖的package包/类
public NotificationResult fetchNotifications(long clientSequenceNumber,
int maxNotifications,
long timeout)
throws IOException {
if (logger.debugOn()) logger.debug("fetchNotifications",
"connectionId=" + connectionId
+", timeout=" + timeout);
if (maxNotifications < 0 || timeout < 0)
throw new IllegalArgumentException("Illegal negative argument");
final boolean serverTerminated =
serverCommunicatorAdmin.reqIncoming();
try {
if (serverTerminated) {
// we must not call fetchNotifs() if the server is
// terminated (timeout elapsed).
//
return new NotificationResult(0L, 0L,
new TargetedNotification[0]);
}
final long csn = clientSequenceNumber;
final int mn = maxNotifications;
final long t = timeout;
PrivilegedAction<NotificationResult> action =
new PrivilegedAction<NotificationResult>() {
public NotificationResult run() {
return getServerNotifFwd().fetchNotifs(csn, t, mn);
}
};
if (acc == null)
return action.run();
else
return AccessController.doPrivileged(action, acc);
} finally {
serverCommunicatorAdmin.rspOutgoing();
}
}
示例6: fetchNotifs
import javax.management.remote.NotificationResult; //导入依赖的package包/类
private NotificationResult fetchNotifs() {
try {
NotificationResult nr = ClientNotifForwarder.this.
fetchNotifs(clientSequenceNumber,maxNotifications,
timeout);
if (logger.traceOn()) {
logger.trace("NotifFetcher-run",
"Got notifications from the server: "+nr);
}
return nr;
} catch (ClassNotFoundException | NotSerializableException e) {
logger.trace("NotifFetcher.fetchNotifs", e);
return fetchOneNotif();
} catch (IOException ioe) {
if (!shouldStop()) {
logger.error("NotifFetcher-run",
"Failed to fetch notification, " +
"stopping thread. Error is: " + ioe, ioe);
logger.debug("NotifFetcher-run",ioe);
}
// no more fetching
return null;
}
}