Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
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 (309)
Collections:
Other Resources:
JDK 17 jdk.jfr.jmod - JFR Module
JDK 17 jdk.jfr.jmod is the JMOD file for JDK 17 JFR module.
JDK 17 JFR module compiled class files are stored in \fyicenter\jdk-17.0.5\jmods\jdk.jfr.jmod.
JDK 17 JFR module compiled class files are also linked and stored in the \fyicenter\jdk-17.0.5\lib\modules JImage file.
JDK 17 JFR module source code files are stored in \fyicenter\jdk-17.0.5\lib\src.zip\jdk.jfr.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ jdk/jfr/internal/MetadataWriter.java
/* * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package jdk.jfr.internal; import static jdk.jfr.internal.MetadataDescriptor.ATTRIBUTE_CONSTANT_POOL; import static jdk.jfr.internal.MetadataDescriptor.ATTRIBUTE_DEFAULT_VALUE; import static jdk.jfr.internal.MetadataDescriptor.ATTRIBUTE_DIMENSION; import static jdk.jfr.internal.MetadataDescriptor.ATTRIBUTE_GMT_OFFSET; import static jdk.jfr.internal.MetadataDescriptor.ATTRIBUTE_ID; import static jdk.jfr.internal.MetadataDescriptor.ATTRIBUTE_LOCALE; import static jdk.jfr.internal.MetadataDescriptor.ATTRIBUTE_NAME; import static jdk.jfr.internal.MetadataDescriptor.ATTRIBUTE_SIMPLE_TYPE; import static jdk.jfr.internal.MetadataDescriptor.ATTRIBUTE_SUPER_TYPE; import static jdk.jfr.internal.MetadataDescriptor.ATTRIBUTE_TYPE_ID; import static jdk.jfr.internal.MetadataDescriptor.ELEMENT_ANNOTATION; import static jdk.jfr.internal.MetadataDescriptor.ELEMENT_FIELD; import static jdk.jfr.internal.MetadataDescriptor.ELEMENT_SETTING; import static jdk.jfr.internal.MetadataDescriptor.ELEMENT_TYPE; import java.io.DataOutput; import java.io.IOException; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; import java.util.Set; import jdk.jfr.AnnotationElement; import jdk.jfr.SettingDescriptor; import jdk.jfr.ValueDescriptor; import jdk.jfr.internal.MetadataDescriptor.Attribute; import jdk.jfr.internal.MetadataDescriptor.Element; import jdk.jfr.internal.consumer.StringParser; /** * Class responsible for converting a list of types into a format that can be * parsed by a client. * */ final class MetadataWriter { private final Element metadata = new Element("metadata"); private final Element root = new Element("root"); public MetadataWriter(MetadataDescriptor descriptor) { descriptor.getTypes().forEach(type -> makeTypeElement(metadata, type)); root.add(metadata); Element region = new Element("region"); region.addAttribute(ATTRIBUTE_LOCALE, descriptor.locale); region.addAttribute(ATTRIBUTE_GMT_OFFSET, descriptor.gmtOffset); root.add(region); } public void writeBinary(DataOutput output) throws IOException { Set<String> stringPool = new HashSet<>(1000); // Possible improvement, sort string by how often they occur. // and assign low number to the most frequently used. buildStringPool(root, stringPool); HashMap<String, Integer> lookup = new LinkedHashMap<>(stringPool.size()); int index = 0; int poolSize = stringPool.size(); writeInt(output, poolSize); for (String s : stringPool) { lookup.put(s, index); writeString(output, s); index++; } write(output, root, lookup); } private void writeString(DataOutput out, String s) throws IOException { if (s == null ) { out.writeByte(StringParser.Encoding.NULL.byteValue()); return; } out.writeByte(StringParser.Encoding.CHAR_ARRAY.byteValue()); // encoding UTF-16 int length = s.length(); writeInt(out, length); for (int i = 0; i < length; i++) { writeInt(out, s.charAt(i)); } } private void writeInt(DataOutput out, int v) throws IOException { long s = v & 0xffffffffL; if (s < 1 << 7) { out.write((byte) (s)); return; } out.write((byte) (s | 0x80)); // first byte written s >>= 7; if (s < 1 << 7) { out.write((byte) (s)); return; } out.write((byte) (s | 0x80)); // second byte written s >>= 7; if (s < 1 << 7) { out.write((byte) (s)); return; } out.write((byte) (s | 0x80)); // third byte written s >>= 7; if (s < 1 << 7) { out.write((byte) (s)); return; } s >>= 7; out.write((byte) (s));// fourth byte written } private void buildStringPool(Element element, Set<String> pool) { pool.add(element.name); for (Attribute a : element.attributes) { pool.add(a.name); pool.add(a.value); } for (Element child : element.elements) { buildStringPool(child, pool); } } private void write(DataOutput output,Element element, HashMap<String, Integer> lookup) throws IOException { writeInt(output, lookup.get(element.name)); writeInt(output, element.attributes.size()); for (Attribute a : element.attributes) { writeInt(output, lookup.get(a.name)); writeInt(output, lookup.get(a.value)); } writeInt(output, element.elements.size()); for (Element child : element.elements) { write(output, child, lookup); } } private void makeTypeElement(Element root, Type type) { Element element = root.newChild(ELEMENT_TYPE); element.addAttribute(ATTRIBUTE_NAME, type.getName()); String superType = type.getSuperType(); if (superType != null) { element.addAttribute(ATTRIBUTE_SUPER_TYPE, superType); } if (type.isSimpleType()) { element.addAttribute(ATTRIBUTE_SIMPLE_TYPE, true); } element.addAttribute(ATTRIBUTE_ID, type.getId()); if (type instanceof PlatformEventType pType) { for (SettingDescriptor v : pType.getSettings()) { makeSettingElement(element, v); } } for (ValueDescriptor v : type.getFields()) { makeFieldElement(element, v); } for (AnnotationElement a : type.getAnnotationElements()) { makeAnnotation(element, a); } } private void makeSettingElement(Element typeElement, SettingDescriptor s) { Element element = typeElement.newChild(ELEMENT_SETTING); element.addAttribute(ATTRIBUTE_NAME, s.getName()); element.addAttribute(ATTRIBUTE_TYPE_ID, s.getTypeId()); element.addAttribute(ATTRIBUTE_DEFAULT_VALUE, s.getDefaultValue()); for (AnnotationElement a : s.getAnnotationElements()) { makeAnnotation(element, a); } } private void makeFieldElement(Element typeElement, ValueDescriptor v) { Element element = typeElement.newChild(ELEMENT_FIELD); element.addAttribute(ATTRIBUTE_NAME, v.getName()); element.addAttribute(ATTRIBUTE_TYPE_ID, v.getTypeId()); if (v.isArray()) { element.addAttribute(ATTRIBUTE_DIMENSION, 1); } if (PrivateAccess.getInstance().isConstantPool(v)) { element.addAttribute(ATTRIBUTE_CONSTANT_POOL, true); } for (AnnotationElement a : v.getAnnotationElements()) { makeAnnotation(element, a); } } private void makeAnnotation(Element entity, AnnotationElement annotation) { Element element = entity.newChild(ELEMENT_ANNOTATION); element.addAttribute(ATTRIBUTE_TYPE_ID, annotation.getTypeId()); List<Object> values = annotation.getValues(); int index = 0; for (ValueDescriptor v : annotation.getValueDescriptors()) { Object value = values.get(index++); if (v.isArray()) { element.addArrayAttribute(element, v.getName(), value); } else { element.addAttribute(v.getName(), value); } } } }
⏎ jdk/jfr/internal/MetadataWriter.java
Or download all of them as a single archive file:
File name: jdk.jfr-17.0.5-src.zip File size: 363343 bytes Release date: 2022-09-13 Download
⇒ JDK 17 jdk.jlink.jmod - JLink Tool
2023-04-17, 8943👍, 0💬
Popular Posts:
SLF4J API is a simple API that allows to plug in any desired logging library at deployment time. Her...
JDK 11 jdk.internal.opt.jmod is the JMOD file for JDK 11 Internal Opt module. JDK 11 Internal Opt mo...
JDK 11 jdk.internal.vm.ci.jmod is the JMOD file for JDK 11 Internal VM CI module. JDK 11 Internal VM...
The Web Services Description Language for Java Toolkit (WSDL4J), Release 1.6.2, allows the creation,...
How to run "jar" command from JDK tools.jar file? "jar" is the JAR (Java Archive) file management co...