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 jdk.internal.jvmstat.jmod - Internal JVM Stat Module
JDK 17 jdk.internal.JVM Stat.jmod is the JMOD file for JDK 17 Internal Jvmstat module.
JDK 17 Internal JVM Stat module compiled class files are stored in \fyicenter\jdk-17.0.5\jmods\jdk.internal.jvmstat.jmod.
JDK 17 Internal JVM Stat module compiled class files are also linked and stored in the \fyicenter\jdk-17.0.5\lib\modules JImage file.
JDK 17 Internal JVM Stat module source code files are stored in \fyicenter\jdk-17.0.5\lib\src.zip\jdk.internal.jvmstat.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ sun/jvmstat/perfdata/monitor/protocol/local/MonitoredHostProvider.java
/*
* Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package sun.jvmstat.perfdata.monitor.protocol.local;
import sun.jvmstat.monitor.*;
import sun.jvmstat.monitor.event.*;
import sun.jvmstat.perfdata.monitor.*;
import java.util.*;
import java.net.*;
/**
* Concrete implementation of the MonitoredHost interface for the
* <em>local</em> protocol of the HotSpot PerfData monitoring implementation.
*
* @author Brian Doherty
* @since 1.5
*/
public class MonitoredHostProvider extends MonitoredHost {
private static final int DEFAULT_POLLING_INTERVAL = 1000;
private ArrayList<HostListener> listeners;
private NotifierTask task;
private HashSet<Integer> activeVms;
private LocalVmManager vmManager;
/**
* Create a MonitoredHostProvider instance using the given HostIdentifier.
*
* @param hostId the host identifier for this MonitoredHost
*/
public MonitoredHostProvider(HostIdentifier hostId) {
this.hostId = hostId;
this.listeners = new ArrayList<HostListener>();
this.interval = DEFAULT_POLLING_INTERVAL;
this.activeVms = new HashSet<Integer>();
this.vmManager = new LocalVmManager();
}
/**
* {@inheritDoc}
*/
public MonitoredVm getMonitoredVm(VmIdentifier vmid)
throws MonitorException {
return getMonitoredVm(vmid, DEFAULT_POLLING_INTERVAL);
}
/**
* {@inheritDoc}
*/
public MonitoredVm getMonitoredVm(VmIdentifier vmid, int interval)
throws MonitorException {
try {
VmIdentifier nvmid = hostId.resolve(vmid);
return new LocalMonitoredVm(nvmid, interval);
} catch (URISyntaxException e) {
/*
* the VmIdentifier is expected to be a valid and it should
* resolve reasonably against the host identifier. A
* URISyntaxException here is most likely a programming error.
*/
throw new IllegalArgumentException("Malformed URI: "
+ vmid.toString(), e);
}
}
/**
* {@inheritDoc}
*/
public void detach(MonitoredVm vm) {
vm.detach();
}
/**
* {@inheritDoc}
*/
public void addHostListener(HostListener listener) {
synchronized(listeners) {
listeners.add(listener);
if (task == null) {
task = new NotifierTask();
LocalEventTimer timer = LocalEventTimer.getInstance();
timer.schedule(task, interval, interval);
}
}
}
/**
* {@inheritDoc}
*/
public void removeHostListener(HostListener listener) {
synchronized(listeners) {
listeners.remove(listener);
if (listeners.isEmpty() && (task != null)) {
task.cancel();
task = null;
}
}
}
/**
* {@inheritDoc}
*/
public void setInterval(int newInterval) {
synchronized(listeners) {
if (newInterval == interval) {
return;
}
int oldInterval = interval;
super.setInterval(newInterval);
if (task != null) {
task.cancel();
NotifierTask oldTask = task;
task = new NotifierTask();
LocalEventTimer timer = LocalEventTimer.getInstance();
CountedTimerTaskUtils.reschedule(timer, oldTask, task,
oldInterval, newInterval);
}
}
}
/**
* {@inheritDoc}
*/
public Set<Integer> activeVms() {
return vmManager.activeVms();
}
/**
* Fire VmEvent events.
*
* @param active a set of Integer objects containing the vmid of
* the active Vms
* @param started a set of Integer objects containing the vmid of
* new Vms started since last interval.
* @param terminated a set of Integer objects containing the vmid of
* terminated Vms since last interval.
*/
@SuppressWarnings("unchecked") // Cast of result of clone
private void fireVmStatusChangedEvents(Set<Integer> active, Set<Integer> started,
Set<Integer> terminated) {
ArrayList<HostListener> registered = null;
VmStatusChangeEvent ev = null;
synchronized(listeners) {
registered = (ArrayList)listeners.clone();
}
for (Iterator<HostListener> i = registered.iterator(); i.hasNext(); /* empty */) {
HostListener l = i.next();
if (ev == null) {
ev = new VmStatusChangeEvent(this, active, started, terminated);
}
l.vmStatusChanged(ev);
}
}
/**
* Class to poll the local system and generate event notifications.
*/
private class NotifierTask extends CountedTimerTask {
public void run() {
super.run();
// save the last set of active JVMs
Set<Integer> lastActiveVms = activeVms;
// get the current set of active JVMs
activeVms = (HashSet<Integer>)vmManager.activeVms();
if (activeVms.isEmpty()) {
return;
}
Set<Integer> startedVms = new HashSet<>();
Set<Integer> terminatedVms = new HashSet<>();
for (Iterator<Integer> i = activeVms.iterator(); i.hasNext(); /* empty */) {
Integer vmid = i.next();
if (!lastActiveVms.contains(vmid)) {
// a new file has been detected, add to set
startedVms.add(vmid);
}
}
for (Iterator<Integer> i = lastActiveVms.iterator(); i.hasNext();
/* empty */) {
Integer o = i.next();
if (!activeVms.contains(o)) {
// JVM has terminated, remove it from the active list
terminatedVms.add(o);
}
}
if (!startedVms.isEmpty() || !terminatedVms.isEmpty()) {
fireVmStatusChangedEvents(activeVms, startedVms,
terminatedVms);
}
}
}
}
⏎ sun/jvmstat/perfdata/monitor/protocol/local/MonitoredHostProvider.java
Or download all of them as a single archive file:
File name: jdk.internal.jvmstat-17.0.5-src.zip File size: 89372 bytes Release date: 2022-09-13 Download
⇒ JDK 17 jdk.internal.le.jmod - Internal Line Editing Module
2023-08-25, ≈12🔥, 0💬
Popular Posts:
Guava is a suite of core and expanded libraries that include utility classes, google's collections, ...
Joda-Time provides a quality replacement for the Java date and time classes. The design allows for m...
What Is js.jar in Rhino JavaScript 1.7R5? js.jar in Rhino JavaScript 1.7R5 is the JAR file for Rhino...
What Is mail.jar of JavaMail 1.4.2? I got the JAR file from javamail-1.4.2.zip. mail.jar in javamail...
Jettison is a collection of Java APIs (like STaX and DOM) which read and write JSON. This allows nea...