65
65
import org .graalvm .visualvm .heapviewer .ui .TreeTableViewColumn ;
66
66
import org .graalvm .visualvm .heapviewer .ui .UIThresholds ;
67
67
import org .graalvm .visualvm .heapviewer .utils .ExcludingIterator ;
68
+ import org .graalvm .visualvm .heapviewer .utils .InterruptibleIterator ;
68
69
import org .graalvm .visualvm .heapviewer .utils .NodesComputer ;
69
70
import org .graalvm .visualvm .heapviewer .utils .ProgressIterator ;
70
71
import org .graalvm .visualvm .heapviewer .utils .counters .InstanceCounter ;
@@ -143,7 +144,7 @@ public JavaFieldsPlugin(HeapContext context, HeapViewerActions actions) {
143
144
};
144
145
objectsView = new TreeTableView ("java_objects_fields" , context , actions , columns ) { // NOI18N
145
146
@ Override
146
- protected HeapViewerNode [] computeData (RootNode root , Heap heap , String viewID , HeapViewerNodeFilter viewFilter , List <DataType > dataTypes , List <SortOrder > sortOrders , Progress progress ) {
147
+ protected HeapViewerNode [] computeData (RootNode root , Heap heap , String viewID , HeapViewerNodeFilter viewFilter , List <DataType > dataTypes , List <SortOrder > sortOrders , Progress progress ) throws InterruptedException {
147
148
HeapViewerNode _selected ;
148
149
synchronized (objectsView ) { _selected = selected ; }
149
150
@@ -312,7 +313,7 @@ static InstancesWrapper fromNode(HeapViewerNode node) {
312
313
}
313
314
314
315
315
- private HeapViewerNode [] getClassFieldsHistogram (final InstancesWrapper instances , HeapViewerNode parent , Heap heap , String viewID , HeapViewerNodeFilter viewFilter , List <DataType > dataTypes , List <SortOrder > sortOrders , Progress progress ) {
316
+ private HeapViewerNode [] getClassFieldsHistogram (final InstancesWrapper instances , HeapViewerNode parent , Heap heap , String viewID , HeapViewerNodeFilter viewFilter , List <DataType > dataTypes , List <SortOrder > sortOrders , Progress progress ) throws InterruptedException {
316
317
final List <Field > fields = getAllInstanceFields (instances .getJavaClass ());
317
318
NodesComputer <Field > computer = new NodesComputer <Field >(fields .size (), UIThresholds .MAX_INSTANCE_FIELDS ) {
318
319
protected boolean sorts (DataType dataType ) {
@@ -382,7 +383,7 @@ public String toString() {
382
383
383
384
abstract Iterator <Instance > instancesIterator ();
384
385
385
- protected HeapViewerNode [] lazilyComputeChildren (Heap heap , String viewID , HeapViewerNodeFilter viewFilter , List <DataType > dataTypes , List <SortOrder > sortOrders , Progress progress ) {
386
+ protected HeapViewerNode [] lazilyComputeChildren (Heap heap , String viewID , HeapViewerNodeFilter viewFilter , List <DataType > dataTypes , List <SortOrder > sortOrders , Progress progress ) throws InterruptedException {
386
387
String fieldTypeName = fieldType .getName ();
387
388
388
389
if ("object" .equals (fieldTypeName )) { // NOI18N
@@ -403,10 +404,9 @@ protected HeapViewerNode[] lazilyComputeChildren(Heap heap, String viewID, HeapV
403
404
if (!computingChildren ) return null ;
404
405
} finally {
405
406
computingChildren = false ;
407
+ progress .finish ();
406
408
}
407
409
408
- progress .finish ();
409
-
410
410
valuesCount = values .size ();
411
411
412
412
NodesComputer <InstanceCounter .Record > computer = new NodesComputer <InstanceCounter .Record >(valuesCount , 20 ) {
@@ -458,10 +458,9 @@ protected String getNodesContainerString(String firstNodeIdx, String lastNodeIdx
458
458
if (!computingChildren ) return null ;
459
459
} finally {
460
460
computingChildren = false ;
461
+ progress .finish ();
461
462
}
462
463
463
- progress .finish ();
464
-
465
464
valuesCount = counter .size ();
466
465
467
466
NodesComputer <PrimitiveCounter .Record > computer = new NodesComputer <PrimitiveCounter .Record >(valuesCount , 20 ) {
@@ -550,9 +549,9 @@ protected Object getValue(DataType type, Heap heap) {
550
549
}
551
550
552
551
553
- protected HeapViewerNode [] lazilyComputeChildren (Heap heap , String viewID , HeapViewerNodeFilter viewFilter , List <DataType > dataTypes , List <SortOrder > sortOrders , Progress progress ) {
554
-
552
+ protected HeapViewerNode [] lazilyComputeChildren (Heap heap , String viewID , HeapViewerNodeFilter viewFilter , List <DataType > dataTypes , List <SortOrder > sortOrders , Progress progress ) throws InterruptedException {
555
553
final String fieldName = fieldName ();
554
+
556
555
NodesComputer <Instance > computer = new NodesComputer <Instance >(valuesCount , 20 ) {
557
556
protected boolean sorts (DataType dataType ) {
558
557
return true ;
@@ -565,7 +564,7 @@ public boolean isLeaf() {
565
564
};
566
565
}
567
566
protected ProgressIterator <Instance > objectsIterator (int index , Progress progress ) {
568
- Iterator <Instance > fieldInstanceIterator = new ExcludingIterator <Instance >(instancesIterator ()) {
567
+ Iterator <Instance > fieldInstanceIterator = new ExcludingIterator <Instance >(new InterruptibleIterator ( instancesIterator () )) {
569
568
@ Override
570
569
protected boolean exclude (Instance instance ) {
571
570
FieldValue value = getValueOfField (instance , fieldName );
@@ -584,6 +583,7 @@ protected String getNodesContainerString(String firstNodeIdx, String lastNodeIdx
584
583
return Bundle .JavaFieldsPlugin_FieldHistogramNodesContainer (firstNodeIdx , lastNodeIdx );
585
584
}
586
585
};
586
+
587
587
return computer .computeNodes (PrimitiveFieldValueNode .this , heap , viewID , null , dataTypes , sortOrders , progress );
588
588
589
589
}
@@ -655,9 +655,9 @@ protected Object getValue(DataType type, Heap heap) {
655
655
}
656
656
657
657
658
- protected HeapViewerNode [] lazilyComputeChildren (Heap heap , String viewID , HeapViewerNodeFilter viewFilter , List <DataType > dataTypes , List <SortOrder > sortOrders , Progress progress ) {
659
-
658
+ protected HeapViewerNode [] lazilyComputeChildren (Heap heap , String viewID , HeapViewerNodeFilter viewFilter , List <DataType > dataTypes , List <SortOrder > sortOrders , Progress progress ) throws InterruptedException {
660
659
final String fieldName = fieldName ();
660
+
661
661
NodesComputer <Instance > computer = new NodesComputer <Instance >(valuesCount , 20 ) {
662
662
protected boolean sorts (DataType dataType ) {
663
663
return true ;
@@ -671,7 +671,7 @@ public boolean isLeaf() {
671
671
}
672
672
protected ProgressIterator <Instance > objectsIterator (int index , Progress progress ) {
673
673
final Instance _instance = getInstance ();
674
- Iterator <Instance > fieldInstanceIterator = new ExcludingIterator <Instance >(instancesIterator ()) {
674
+ Iterator <Instance > fieldInstanceIterator = new ExcludingIterator <Instance >(new InterruptibleIterator ( instancesIterator () )) {
675
675
@ Override
676
676
protected boolean exclude (Instance instance ) {
677
677
FieldValue value = getValueOfField (instance , fieldName );
@@ -692,9 +692,7 @@ protected String getNodesContainerString(String firstNodeIdx, String lastNodeIdx
692
692
}
693
693
};
694
694
695
- HeapViewerNode [] result = computer .computeNodes (InstanceFieldValueNode .this , heap , viewID , null , dataTypes , sortOrders , progress );
696
-
697
- return result ;
695
+ return computer .computeNodes (InstanceFieldValueNode .this , heap , viewID , null , dataTypes , sortOrders , progress );
698
696
699
697
}
700
698
0 commit comments