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 java.instrument.jmod - Instrument Module
JDK 17 java.instrument.jmod is the JMOD file for JDK 17 Instrument module.
JDK 17 Instrument module compiled class files are stored in \fyicenter\jdk-17.0.5\jmods\java.instrument.jmod.
JDK 17 Instrument module compiled class files are also linked and stored in the \fyicenter\jdk-17.0.5\lib\modules JImage file.
JDK 17 Instrument module source code files are stored in \fyicenter\jdk-17.0.5\lib\src.zip\java.instrument.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ sun/instrument/TransformerManager.java
/* * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package sun.instrument; import java.lang.instrument.Instrumentation; import java.lang.instrument.ClassFileTransformer; import java.security.ProtectionDomain; /* * Copyright 2003 Wily Technology, Inc. */ /** * Support class for the InstrumentationImpl. Manages the list of registered transformers. * Keeps everything in the right order, deals with sync of the list, * and actually does the calling of the transformers. */ public class TransformerManager { private class TransformerInfo { final ClassFileTransformer mTransformer; String mPrefix; TransformerInfo(ClassFileTransformer transformer) { mTransformer = transformer; mPrefix = null; } ClassFileTransformer transformer() { return mTransformer; } String getPrefix() { return mPrefix; } void setPrefix(String prefix) { mPrefix = prefix; } } /** * a given instance of this list is treated as immutable to simplify sync; * we pay copying overhead whenever the list is changed rather than every time * the list is referenced. * The array is kept in the order the transformers are added via addTransformer * (first added is 0, last added is length-1) * Use an array, not a List or other Collection. This keeps the set of classes * used by this code to a minimum. We want as few dependencies as possible in this * code, since it is used inside the class definition system. Any class referenced here * cannot be transformed by Java code. */ private TransformerInfo[] mTransformerList; /*** * Is this TransformerManager for transformers capable of retransformation? */ private boolean mIsRetransformable; TransformerManager(boolean isRetransformable) { mTransformerList = new TransformerInfo[0]; mIsRetransformable = isRetransformable; } boolean isRetransformable() { return mIsRetransformable; } public synchronized void addTransformer( ClassFileTransformer transformer) { TransformerInfo[] oldList = mTransformerList; TransformerInfo[] newList = new TransformerInfo[oldList.length + 1]; System.arraycopy( oldList, 0, newList, 0, oldList.length); newList[oldList.length] = new TransformerInfo(transformer); mTransformerList = newList; } public synchronized boolean removeTransformer(ClassFileTransformer transformer) { boolean found = false; TransformerInfo[] oldList = mTransformerList; int oldLength = oldList.length; int newLength = oldLength - 1; // look for it in the list, starting at the last added, and remember // where it was if we found it int matchingIndex = 0; for ( int x = oldLength - 1; x >= 0; x-- ) { if ( oldList[x].transformer() == transformer ) { found = true; matchingIndex = x; break; } } // make a copy of the array without the matching element if ( found ) { TransformerInfo[] newList = new TransformerInfo[newLength]; // copy up to but not including the match if ( matchingIndex > 0 ) { System.arraycopy( oldList, 0, newList, 0, matchingIndex); } // if there is anything after the match, copy it as well if ( matchingIndex < (newLength) ) { System.arraycopy( oldList, matchingIndex + 1, newList, matchingIndex, (newLength) - matchingIndex); } mTransformerList = newList; } return found; } synchronized boolean includesTransformer(ClassFileTransformer transformer) { for (TransformerInfo info : mTransformerList) { if ( info.transformer() == transformer ) { return true; } } return false; } // This function doesn't actually snapshot anything, but should be // used to set a local variable, which will snapshot the transformer // list because of the copying semantics of mTransformerList (see // the comment for mTransformerList). private TransformerInfo[] getSnapshotTransformerList() { return mTransformerList; } public byte[] transform( Module module, ClassLoader loader, String classname, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) { boolean someoneTouchedTheBytecode = false; TransformerInfo[] transformerList = getSnapshotTransformerList(); byte[] bufferToUse = classfileBuffer; // order matters, gotta run 'em in the order they were added for ( int x = 0; x < transformerList.length; x++ ) { TransformerInfo transformerInfo = transformerList[x]; ClassFileTransformer transformer = transformerInfo.transformer(); byte[] transformedBytes = null; try { transformedBytes = transformer.transform( module, loader, classname, classBeingRedefined, protectionDomain, bufferToUse); } catch (Throwable t) { // don't let any one transformer mess it up for the others. // This is where we need to put some logging. What should go here? FIXME } if ( transformedBytes != null ) { someoneTouchedTheBytecode = true; bufferToUse = transformedBytes; } } // if someone modified it, return the modified buffer. // otherwise return null to mean "no transforms occurred" byte [] result; if ( someoneTouchedTheBytecode ) { result = bufferToUse; } else { result = null; } return result; } int getTransformerCount() { TransformerInfo[] transformerList = getSnapshotTransformerList(); return transformerList.length; } boolean setNativeMethodPrefix(ClassFileTransformer transformer, String prefix) { TransformerInfo[] transformerList = getSnapshotTransformerList(); for ( int x = 0; x < transformerList.length; x++ ) { TransformerInfo transformerInfo = transformerList[x]; ClassFileTransformer aTransformer = transformerInfo.transformer(); if ( aTransformer == transformer ) { transformerInfo.setPrefix(prefix); return true; } } return false; } String[] getNativeMethodPrefixes() { TransformerInfo[] transformerList = getSnapshotTransformerList(); String[] prefixes = new String[transformerList.length]; for ( int x = 0; x < transformerList.length; x++ ) { TransformerInfo transformerInfo = transformerList[x]; prefixes[x] = transformerInfo.getPrefix(); } return prefixes; } }
⏎ sun/instrument/TransformerManager.java
Or download all of them as a single archive file:
File name: java.instrument-17.0.5-src.zip File size: 26603 bytes Release date: 2022-09-13 Download
⇒ JDK 17 java.logging.jmod - Logging Module
2023-09-23, 1093👍, 0💬
Popular Posts:
Woodstox 6.4.0 Source Code Files are provided at the Woodstox GitHub Website . You can download them...
JDK 17 jdk.hotspot.agent.jmod is the JMOD file for JDK 17 Hotspot Agent module. JDK 17 Hotspot Agent...
Apache BCEL Source Code Files are inside the Apache BCEL source package file like bcel-6.6.1-src.zip...
Apache Commons Lang 3 is the 3rd version of Apache Commons Lang, which provides a host of helper uti...
What Is poi-5.2.3.jar? poi-5.2.3.jar is one of the JAR files for Apache POI 5.2.3, which provides an...