Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
JDK 17 java.management.jmod - Management Module
JDK 17 java.management.jmod is the JMOD file for JDK 17 Management module.
JDK 17 Management module compiled class files are stored in \fyicenter\jdk-17.0.5\jmods\java.management.jmod.
JDK 17 Management module compiled class files are also linked and stored in the \fyicenter\jdk-17.0.5\lib\modules JImage file.
JDK 17 Management module source code files are stored in \fyicenter\jdk-17.0.5\lib\src.zip\java.management.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ sun/management/NotificationEmitterSupport.java
/*
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package sun.management;
import javax.management.ListenerNotFoundException;
import javax.management.MBeanNotificationInfo;
import javax.management.Notification;
import javax.management.NotificationEmitter;
import javax.management.NotificationFilter;
import javax.management.NotificationListener;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
/**
* Abstract helper class for notification emitter support.
*/
public abstract class NotificationEmitterSupport implements NotificationEmitter {
protected NotificationEmitterSupport() {
}
private Object listenerLock = new Object();
// Implementation of NotificationEmitter interface
// Cloned from JMX NotificationBroadcasterSupport class.
public void addNotificationListener(NotificationListener listener,
NotificationFilter filter,
Object handback) {
if (listener == null) {
throw new IllegalArgumentException ("Listener can't be null") ;
}
/* Adding a new listener takes O(n) time where n is the number
of existing listeners. If you have a very large number of
listeners performance could degrade. That's a fairly
surprising configuration, and it is hard to avoid this
behaviour while still retaining the property that the
listenerList is not synchronized while notifications are
being sent through it. If this becomes a problem, a
possible solution would be a multiple-readers single-writer
setup, so any number of sendNotification() calls could run
concurrently but they would exclude an
add/removeNotificationListener. A simpler but less
efficient solution would be to clone the listener list
every time a notification is sent. */
synchronized (listenerLock) {
List<ListenerInfo> newList = new ArrayList<>(listenerList.size() + 1);
newList.addAll(listenerList);
newList.add(new ListenerInfo(listener, filter, handback));
listenerList = newList;
}
}
public void removeNotificationListener(NotificationListener listener)
throws ListenerNotFoundException {
synchronized (listenerLock) {
List<ListenerInfo> newList = new ArrayList<>(listenerList);
/* We scan the list of listeners in reverse order because
in forward order we would have to repeat the loop with
the same index after a remove. */
for (int i=newList.size()-1; i>=0; i--) {
ListenerInfo li = newList.get(i);
if (li.listener == listener)
newList.remove(i);
}
if (newList.size() == listenerList.size())
throw new ListenerNotFoundException("Listener not registered");
listenerList = newList;
}
}
public void removeNotificationListener(NotificationListener listener,
NotificationFilter filter,
Object handback)
throws ListenerNotFoundException {
boolean found = false;
synchronized (listenerLock) {
List<ListenerInfo> newList = new ArrayList<>(listenerList);
final int size = newList.size();
for (int i = 0; i < size; i++) {
ListenerInfo li = newList.get(i);
if (li.listener == listener) {
found = true;
if (li.filter == filter
&& li.handback == handback) {
newList.remove(i);
listenerList = newList;
return;
}
}
}
}
if (found) {
/* We found this listener, but not with the given filter
* and handback. A more informative exception message may
* make debugging easier. */
throw new ListenerNotFoundException("Listener not registered " +
"with this filter and " +
"handback");
} else {
throw new ListenerNotFoundException("Listener not registered");
}
}
public void sendNotification(Notification notification) {
if (notification == null) {
return;
}
List<ListenerInfo> currentList;
synchronized (listenerLock) {
currentList = listenerList;
}
final int size = currentList.size();
for (int i = 0; i < size; i++) {
ListenerInfo li = currentList.get(i);
if (li.filter == null
|| li.filter.isNotificationEnabled(notification)) {
try {
li.listener.handleNotification(notification, li.handback);
} catch (Exception e) {
e.printStackTrace();
throw new AssertionError("Error in invoking listener");
}
}
}
}
public boolean hasListeners() {
synchronized (listenerLock) {
return !listenerList.isEmpty();
}
}
private class ListenerInfo {
public NotificationListener listener;
NotificationFilter filter;
Object handback;
public ListenerInfo(NotificationListener listener,
NotificationFilter filter,
Object handback) {
this.listener = listener;
this.filter = filter;
this.handback = handback;
}
}
/**
* Current list of listeners, a List of ListenerInfo. The object
* referenced by this field is never modified. Instead, the field
* is set to a new object when a listener is added or removed,
* within a synchronized(this). In this way, there is no need to
* synchronize when traversing the list to send a notification to
* the listeners in it. That avoids potential deadlocks if the
* listeners end up depending on other threads that are themselves
* accessing this NotificationBroadcasterSupport.
*/
private List<ListenerInfo> listenerList = Collections.emptyList();
abstract public MBeanNotificationInfo[] getNotificationInfo();
}
⏎ sun/management/NotificationEmitterSupport.java
Or download all of them as a single archive file:
File name: java.management-17.0.5-src.zip File size: 850134 bytes Release date: 2022-09-13 Download
⇒ JDK 17 java.management.rmi.jmod - Management RMI Module
2023-09-23, ≈66🔥, 0💬
Popular Posts:
Jackson is "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java"....
How to read XML document from socket connections with the socket\DelayedInput.java provided in the A...
Swingx is the SwingLabs Swing Component Extensions. JAR File Size and Download Location: File name: ...
Apache BCEL Source Code Files are inside the Apache BCEL source package file like bcel-6.6.1-src.zip...
What JAR files are required to run dom\Counter.java provided in the Apache Xerces package? You can f...