mirror of
https://github.com/alibaba/arthas.git
synced 2024-04-21 10:21:39 +00:00
retransform command print transformCount. #1651
This commit is contained in:
@@ -280,8 +280,6 @@ public class RetransformCommand extends AnnotatedCommand {
|
||||
classList.add(clazz);
|
||||
retransformModel.addRetransformClass(clazz.getName());
|
||||
|
||||
addRetransformEntry(retransformEntry);
|
||||
|
||||
logger.info("Try retransform class name: {}, ClassLoader: {}", clazz.getName(), clazz.getClassLoader());
|
||||
}
|
||||
}
|
||||
@@ -291,6 +289,7 @@ public class RetransformCommand extends AnnotatedCommand {
|
||||
process.end(-1, "These classes are not found in the JVM and may not be loaded: " + bytesMap.keySet());
|
||||
return;
|
||||
}
|
||||
addRetransformEntry(retransformEntryList);
|
||||
|
||||
inst.retransformClasses(classList.toArray(new Class[0]));
|
||||
|
||||
@@ -352,6 +351,10 @@ public class RetransformCommand extends AnnotatedCommand {
|
||||
this.classLoaderClass = classLoaderClass;
|
||||
}
|
||||
|
||||
public void incTransformCount() {
|
||||
transformCount++;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
@@ -401,10 +404,10 @@ public class RetransformCommand extends AnnotatedCommand {
|
||||
}
|
||||
}
|
||||
|
||||
public static synchronized void addRetransformEntry(RetransformEntry retransformEntry) {
|
||||
public static synchronized void addRetransformEntry(List<RetransformEntry> retransformEntryList) {
|
||||
List<RetransformEntry> tmp = new ArrayList<RetransformEntry>();
|
||||
tmp.addAll(retransformEntries);
|
||||
tmp.add(retransformEntry);
|
||||
tmp.addAll(retransformEntryList);
|
||||
Collections.sort(tmp, new Comparator<RetransformEntry>() {
|
||||
@Override
|
||||
public int compare(RetransformEntry entry1, RetransformEntry entry2) {
|
||||
@@ -468,6 +471,7 @@ public class RetransformCommand extends AnnotatedCommand {
|
||||
if (updateFlag) {
|
||||
logger.info("RetransformCommand match class: {}, id: {}, classLoaderClass: {}, hashCode: {}",
|
||||
className, id, retransformEntry.getClassLoaderClass(), retransformEntry.getHashCode());
|
||||
retransformEntry.incTransformCount();
|
||||
return retransformEntry.getBytes();
|
||||
}
|
||||
|
||||
|
||||
@@ -35,12 +35,12 @@ public class RetransformView extends ResultView<RetransformModel> {
|
||||
// retransform -l
|
||||
if (result.getRetransformEntries() != null) {
|
||||
// header
|
||||
TableElement table = new TableElement(1, 1, 1, 1).rightCellPadding(1);
|
||||
table.add(new RowElement().style(Decoration.bold.bold()).add("Id", "ClassName", "LoaderHash",
|
||||
TableElement table = new TableElement(1, 1, 1, 1, 1).rightCellPadding(1);
|
||||
table.add(new RowElement().style(Decoration.bold.bold()).add("Id", "ClassName", "TransformCount", "LoaderHash",
|
||||
"LoaderClassName"));
|
||||
|
||||
for (RetransformEntry entry : result.getRetransformEntries()) {
|
||||
table.row("" + entry.getId(), "" + entry.getClassName(), "" + entry.getHashCode(),
|
||||
table.row("" + entry.getId(), "" + entry.getClassName(), "" + entry.getTransformCount(), "" + entry.getHashCode(),
|
||||
"" + entry.getClassLoaderClass());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user