incubator-kato-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spo...@apache.org
Subject svn commit: r831858 [2/2] - in /incubator/kato/branches/experimental/thirdview/org.apache.kato: kato.api/src/main/java/javax/tools/diagnostics/runtime/java/ kato.api/src/test/java/test/apache/kato/ kato.cjvmti/src/main/java/org/apache/kato/jvmti/javaru...
Date Mon, 02 Nov 2009 10:58:12 GMT
Modified: incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaClassLoaderImpl.java
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaClassLoaderImpl.java?rev=831858&r1=831857&r2=831858&view=diff
==============================================================================
--- incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaClassLoaderImpl.java (original)
+++ incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaClassLoaderImpl.java Mon Nov  2 10:58:10 2009
@@ -13,16 +13,19 @@
  ******************************************************************************/
 package org.apache.kato.hprof.java;
 
+import java.io.IOException;
 import java.util.Collection;
 import java.util.Iterator;
-import java.util.LinkedList;
 import java.util.List;
 
+import javax.tools.diagnostics.QueryResult;
 import javax.tools.diagnostics.image.CorruptDataException;
+import javax.tools.diagnostics.runtime.java.JVMClass;
 import javax.tools.diagnostics.runtime.java.JVMClassLoader;
 import javax.tools.diagnostics.runtime.java.JVMObject;
 
-import org.apache.kato.common.IteratorBackedList;
+import org.apache.kato.common.EmptyQueryResult;
+import org.apache.kato.common.corruptdata.CorruptJVMClass;
 import org.apache.kato.hprof.IJavaClassLoader;
 import org.apache.kato.hprof.image.CorruptDataImpl;
 
@@ -74,51 +77,56 @@
 	 * 
 	 * FIXME It may be possible to pull out the classes from the java.lang.ClassLoader.classes Vector 
 	 */
-	public List getCachedClasses() {
-		return new LinkedList();
+	public QueryResult<JVMClass> getCachedClasses() {
+		return new EmptyQueryResult<JVMClass>();
 	}
 
 	@Override
-	public List getDefinedClasses() {
-		return new IteratorBackedList(new ClassesIterator());
-	}
+	public QueryResult<JVMClass> getDefinedClasses() {
+		return new QueryResult<JVMClass>() {
+			private List<Long> classes = loader.getClasses();
+			@Override
+			public void dispose() throws IOException {
+			
+				classes=null;
+			}
 
-	/**
-	 * An iterator over the classes loaded by this class loader.
-	 * Wraps the IDs this class loader holds with JavaClassImpls.
-	 * 
-	 * @author monteith
-	 *
-	 */
-	private class ClassesIterator implements Iterator {
-		private Collection<Long> classes = loader.getClasses();
-		private Iterator<Long> iterator = classes.iterator();		
-		@Override
-		public boolean hasNext() {
-			return iterator.hasNext();
-		}
+			@Override
+			public JVMClass get(long element) throws IOException,
+					IndexOutOfBoundsException {
+				
+				Long ID = classes.get((int) element);
+				JavaClassImpl clazz = heap.getJavaClassByID(ID);
+
+				if (clazz == null) {
+					return new CorruptJVMClass(new CorruptDataImpl(heap.getImagePointer(ID), "Can't match class object ID to a JavaClassImpl."));
+				}
+				return null;
+			}
 
-		@Override
-		public Object next() {
-			Long ID = iterator.next();
-			JavaClassImpl clazz = heap.getJavaClassByID(ID);
+			@Override
+			public boolean isEmpty() {
+				
+				return classes.isEmpty();
+			}
 
-			if (clazz == null) {
-				return new CorruptDataImpl(heap.getImagePointer(ID), "Can't match class object ID to a JavaClassImpl.");
+			@Override
+			public long size() throws IOException {
+				
+				return classes.size();
 			}
-			
-			return clazz;
-		}
 
-		/**
-		 * Not implemented.
-		 */
-		@Override
-		public void remove() {
-			throw new UnsupportedOperationException("remove() not supported for ClassesIterator");
-		}
+			@Override
+			public Iterator<JVMClass> iterator() {
+				
+				return null;
+			}
+		}; 
+		
 		
 	}
+
+	
 	
 	/**
 	 * Gets the java/lang/ClassLoader object from the heap.

Modified: incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaHeapImpl.java
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaHeapImpl.java?rev=831858&r1=831857&r2=831858&view=diff
==============================================================================
--- incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaHeapImpl.java (original)
+++ incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaHeapImpl.java Mon Nov  2 10:58:10 2009
@@ -19,12 +19,16 @@
 import java.util.List;
 import java.util.NoSuchElementException;
 
+import javax.tools.diagnostics.QueryResult;
 import javax.tools.diagnostics.image.ImageAddressSpace;
 import javax.tools.diagnostics.image.ImagePointer;
+import javax.tools.diagnostics.image.ImageSection;
 import javax.tools.diagnostics.runtime.java.JVMClass;
+import javax.tools.diagnostics.runtime.java.JVMClassLoader;
 import javax.tools.diagnostics.runtime.java.JVMObject;
 
 import org.apache.kato.common.BasicType;
+import org.apache.kato.common.EmptyQueryResult;
 import org.apache.kato.common.IteratorBackedList;
 import org.apache.kato.common.ObjectMapList;
 import org.apache.kato.hprof.HProfView;
@@ -63,11 +67,11 @@
 	}
 
 	@Override
-	public List getObjects() {
+	public QueryResult<JVMObject>  getObjects() {
 		
 		final IHeapDumpHProfRecord record=view.getHeapRecord();
 		
-		if(record==null) return new LinkedList();
+		if(record==null) return new EmptyQueryResult<JVMObject>();
 		
 		
 		
@@ -130,13 +134,13 @@
 		
 
 			iter.hasNext(); // initialize iterator.
-			return new IteratorBackedList(iter);
+			return  new IteratorBackedList(iter);
 	}
 
 	
 	@Override
-	public List getSections() {
-		return new LinkedList();
+	public QueryResult<ImageSection> getSections() {
+		return new EmptyQueryResult<ImageSection>();
 	}
 
 	/**
@@ -275,7 +279,7 @@
 	/**
 	 * Map from JavaClassLoader IDs to JavaClassLoaders.
 	 */
-	private ObjectMapList<Long,JavaClassLoaderImpl> javaClassLoaders;
+	private ObjectMapList<Long,JVMClassLoader> javaClassLoaders;
 	
 	/**
 	 * Create a map of JavaClassLoader object ID's to JavaClassLoaderImpl's.
@@ -285,7 +289,7 @@
 	 */
 	private void createJavaClassLoaders() {
 		if (javaClassLoaders == null) {
-			javaClassLoaders = new ObjectMapList<Long,JavaClassLoaderImpl>();
+			javaClassLoaders = new ObjectMapList<Long,JVMClassLoader>();
 			for (IJavaClassLoader loader : view.getJavaClassLoaders()) {
 				javaClassLoaders.put(loader.getID(),new JavaClassLoaderImpl(this, loader));
 			}
@@ -297,7 +301,7 @@
 	 * Returns the java class loaders
 	 * @return 
 	 */
-	public List<JavaClassLoaderImpl> getJavaClassLoaders() {
+	public List<JVMClassLoader> getJavaClassLoaders() {
 		createJavaClassLoaders();
 		return javaClassLoaders.values();
 	}
@@ -309,7 +313,7 @@
 	 * @return
 	 */
 	@Override
-	public JavaClassLoaderImpl getJavaClassLoaderByID(long ID) {
+	public JVMClassLoader getJavaClassLoaderByID(long ID) {
 		createJavaClassLoaders();
 		return javaClassLoaders.get(ID);
 	}

Modified: incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaObjectArrayImpl.java
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaObjectArrayImpl.java?rev=831858&r1=831857&r2=831858&view=diff
==============================================================================
--- incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaObjectArrayImpl.java (original)
+++ incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaObjectArrayImpl.java Mon Nov  2 10:58:10 2009
@@ -15,16 +15,19 @@
 
 
 import java.util.LinkedList;
-import java.util.List;
 
+import javax.tools.diagnostics.QueryResult;
 import javax.tools.diagnostics.image.CorruptDataException;
 import javax.tools.diagnostics.image.DataUnavailable;
 import javax.tools.diagnostics.image.ImagePointer;
+import javax.tools.diagnostics.image.ImageSection;
 import javax.tools.diagnostics.image.MemoryAccessException;
 import javax.tools.diagnostics.runtime.java.JVMClass;
 import javax.tools.diagnostics.runtime.java.JVMHeap;
 import javax.tools.diagnostics.runtime.java.JVMObject;
+import javax.tools.diagnostics.runtime.java.JVMReference;
 
+import org.apache.kato.common.EmptyQueryResult;
 import org.apache.kato.hprof.datalayer.IGCObjectArrayHeapDumpRecord;
 
 /**
@@ -117,13 +120,13 @@
 		throw new DataUnavailable("Persistent hashcode unknown.");	}
 
 	@Override
-	public List getReferences() {
-		return new LinkedList();
+	public QueryResult<JVMReference> getReferences() {
+		return new EmptyQueryResult<JVMReference>();
 	}
 
 	@Override
-	public List getSections() {
-		return new LinkedList();
+	public QueryResult<ImageSection> getSections() {
+		return new EmptyQueryResult<ImageSection>();
 	}
 
 	@Override

Modified: incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaObjectInstanceImpl.java
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaObjectInstanceImpl.java?rev=831858&r1=831857&r2=831858&view=diff
==============================================================================
--- incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaObjectInstanceImpl.java (original)
+++ incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaObjectInstanceImpl.java Mon Nov  2 10:58:10 2009
@@ -14,15 +14,18 @@
 package org.apache.kato.hprof.java;
 
 import java.util.LinkedList;
-import java.util.List;
 
+import javax.tools.diagnostics.QueryResult;
 import javax.tools.diagnostics.image.CorruptDataException;
 import javax.tools.diagnostics.image.DataUnavailable;
 import javax.tools.diagnostics.image.ImagePointer;
+import javax.tools.diagnostics.image.ImageSection;
 import javax.tools.diagnostics.image.MemoryAccessException;
 import javax.tools.diagnostics.runtime.java.JVMHeap;
 import javax.tools.diagnostics.runtime.java.JVMObject;
+import javax.tools.diagnostics.runtime.java.JVMReference;
 
+import org.apache.kato.common.EmptyQueryResult;
 import org.apache.kato.hprof.datalayer.IGCInstanceHeapDumpRecord;
 
 final class JavaObjectInstanceImpl implements JVMObject {
@@ -83,13 +86,13 @@
 	}
 
 	@Override
-	public List getReferences() {
-		return new LinkedList();
+	public QueryResult<JVMReference> getReferences() {
+		return new EmptyQueryResult<JVMReference>();
 	}
 
 	@Override
-	public List getSections() {		
-		return new LinkedList();
+	public QueryResult<ImageSection> getSections() {		
+		return new EmptyQueryResult<ImageSection>();
 	}
 
 	@Override

Modified: incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaPrimitiveArrayImpl.java
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaPrimitiveArrayImpl.java?rev=831858&r1=831857&r2=831858&view=diff
==============================================================================
--- incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaPrimitiveArrayImpl.java (original)
+++ incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaPrimitiveArrayImpl.java Mon Nov  2 10:58:10 2009
@@ -15,17 +15,20 @@
 
 
 import java.util.LinkedList;
-import java.util.List;
 
+import javax.tools.diagnostics.QueryResult;
 import javax.tools.diagnostics.image.CorruptDataException;
 import javax.tools.diagnostics.image.DataUnavailable;
 import javax.tools.diagnostics.image.ImagePointer;
+import javax.tools.diagnostics.image.ImageSection;
 import javax.tools.diagnostics.image.MemoryAccessException;
 import javax.tools.diagnostics.runtime.java.JVMClass;
 import javax.tools.diagnostics.runtime.java.JVMHeap;
 import javax.tools.diagnostics.runtime.java.JVMObject;
+import javax.tools.diagnostics.runtime.java.JVMReference;
 
 import org.apache.kato.common.BasicType;
+import org.apache.kato.common.EmptyQueryResult;
 import org.apache.kato.hprof.datalayer.IGCPrimitiveArrayHeapDumpRecord;
 import org.apache.kato.hprof.image.CorruptDataImpl;
 
@@ -207,13 +210,13 @@
 		throw new DataUnavailable("Persistent hashcode unknown.");	}
 
 	@Override
-	public List getReferences() {
-		return new LinkedList();
+	public QueryResult<JVMReference> getReferences() {
+		return new EmptyQueryResult<JVMReference>();
 	}
 
 	@Override
-	public List getSections() {
-		return new LinkedList();
+	public QueryResult<ImageSection> getSections() {
+		return new EmptyQueryResult<ImageSection>();
 	}
 
 	@Override

Modified: incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaPrimitiveClassImpl.java
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaPrimitiveClassImpl.java?rev=831858&r1=831857&r2=831858&view=diff
==============================================================================
--- incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaPrimitiveClassImpl.java (original)
+++ incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaPrimitiveClassImpl.java Mon Nov  2 10:58:10 2009
@@ -13,15 +13,19 @@
  ******************************************************************************/
 package org.apache.kato.hprof.java;
 
-import java.util.List;
 import java.util.Vector;
 
+import javax.tools.diagnostics.QueryResult;
 import javax.tools.diagnostics.image.CorruptDataException;
 import javax.tools.diagnostics.image.ImagePointer;
 import javax.tools.diagnostics.runtime.java.JVMClass;
 import javax.tools.diagnostics.runtime.java.JVMClassLoader;
+import javax.tools.diagnostics.runtime.java.JVMField;
+import javax.tools.diagnostics.runtime.java.JVMMethod;
 import javax.tools.diagnostics.runtime.java.JVMObject;
+import javax.tools.diagnostics.runtime.java.JVMReference;
 
+import org.apache.kato.common.EmptyQueryResult;
 import org.apache.kato.hprof.image.ImagePointerImpl;
 
 /**
@@ -52,18 +56,18 @@
 	}
 
 	@Override
-	public List getConstantPoolReferences() {
-		return new Vector(0);
+	public QueryResult<JVMObject> getConstantPoolReferences() {
+		return new EmptyQueryResult<JVMObject>();
 	}
 
 	@Override
-	public List getDeclaredFields() {
-		return new Vector(0);
+	public QueryResult<JVMField> getDeclaredFields() {
+		return new EmptyQueryResult<JVMField>();
 	}
 
 	@Override
-	public List getDeclaredMethods() {
-		return new Vector(0);
+	public QueryResult<JVMMethod> getDeclaredMethods() {
+		return new EmptyQueryResult<JVMMethod>();
 	}
 
 	
@@ -74,8 +78,8 @@
 	}
 
 	@Override
-	public List getInterfaces() {
-		return new Vector(0);
+	public QueryResult<String> getInterfaces() {
+		return new EmptyQueryResult<String>();
 	}
 
 	@Override
@@ -97,8 +101,8 @@
 	}
 
 	@Override
-	public List getReferences() {
-		return new Vector(0);
+	public QueryResult<JVMReference> getReferences() {
+		return new EmptyQueryResult<JVMReference>();
 	}
 
 	@Override

Modified: incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaRuntimeImpl.java
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaRuntimeImpl.java?rev=831858&r1=831857&r2=831858&view=diff
==============================================================================
--- incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaRuntimeImpl.java (original)
+++ incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaRuntimeImpl.java Mon Nov  2 10:58:10 2009
@@ -19,16 +19,24 @@
 import java.util.LinkedList;
 import java.util.List;
 
+import javax.tools.diagnostics.QueryResult;
 import javax.tools.diagnostics.image.CorruptDataException;
 import javax.tools.diagnostics.image.DataUnavailable;
 import javax.tools.diagnostics.image.ImageAddressSpace;
 import javax.tools.diagnostics.image.ImagePointer;
 import javax.tools.diagnostics.image.MemoryAccessException;
+import javax.tools.diagnostics.runtime.java.JVMClassLoader;
 import javax.tools.diagnostics.runtime.java.JVMHeap;
+import javax.tools.diagnostics.runtime.java.JVMInitArgs;
+import javax.tools.diagnostics.runtime.java.JVMMethod;
+import javax.tools.diagnostics.runtime.java.JVMMonitor;
 import javax.tools.diagnostics.runtime.java.JVMObject;
+import javax.tools.diagnostics.runtime.java.JVMReference;
 import javax.tools.diagnostics.runtime.java.JVMRuntime;
-import javax.tools.diagnostics.runtime.java.JVMInitArgs;
+import javax.tools.diagnostics.runtime.java.JVMThread;
 
+import org.apache.kato.common.EmptyQueryResult;
+import org.apache.kato.common.ListBackedQueryResult;
 import org.apache.kato.hprof.HProfView;
 import org.apache.kato.hprof.IJavaThread;
 import org.apache.kato.hprof.image.CorruptDataImpl;
@@ -51,15 +59,12 @@
 	}
 	
 	@Override
-	public List getCompiledMethods() {
-		
-		
-		List l=new LinkedList();
-		return l;
+	public QueryResult<JVMMethod> getCompiledMethods() {
+		return new EmptyQueryResult<JVMMethod>();
 	}
 
 	@Override
-	public List getHeapRoots() {
+	public QueryResult<JVMReference> getHeapRoots() {
 		// TODO Auto-generated method stub
 		return null;
 	}
@@ -67,10 +72,10 @@
 	private JavaHeapImpl heap;
 	
 	@Override
-	public List getHeaps() {
-		List<JavaHeapImpl> l=new LinkedList<JavaHeapImpl>();
+	public QueryResult<JVMHeap> getHeaps() {
+		List<JVMHeap> l=new LinkedList<JVMHeap>();
 		l.add(heap);
-		return l;
+		return new ListBackedQueryResult<JVMHeap>(l);
 	}
 
 	
@@ -82,8 +87,8 @@
 	 * @return Iterator<JavaClassLoaderImpl>
 	 */
 	@Override	
-	public List getJavaClassLoaders() {
-		return heap.getJavaClassLoaders();
+	public QueryResult<JVMClassLoader> getJavaClassLoaders() {
+		return new ListBackedQueryResult<JVMClassLoader>(heap.getJavaClassLoaders());
 	}
 
 	
@@ -107,8 +112,8 @@
 	 * @return empty Iterator
 	 */
 	@Override
-	public List getMonitors() {		
-		return new LinkedList();
+	public QueryResult<JVMMonitor> getMonitors() {		
+		return new EmptyQueryResult<JVMMonitor>();
 	}
 
 	/**
@@ -134,11 +139,11 @@
 		return obj;
 	}
 
-	private List<JavaThreadImpl> threads = null;
+	private List<JVMThread> threads = null;
 	@Override
-	public List getThreads() {
+	public QueryResult<JVMThread> getThreads() {
 		if(threads == null) {
-			threads = new LinkedList<JavaThreadImpl>();
+			threads = new LinkedList<JVMThread>();
 
 			Collection<IJavaThread> ithreads = view.getActiveThreads();
 			Iterator<IJavaThread> iter = ithreads.iterator();
@@ -149,7 +154,7 @@
 			}		
 		}
 		
-		return threads;
+		return new ListBackedQueryResult<JVMThread>(threads);
 	}
 
 	/**

Modified: incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaStackFrameImpl.java
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaStackFrameImpl.java?rev=831858&r1=831857&r2=831858&view=diff
==============================================================================
--- incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaStackFrameImpl.java (original)
+++ incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaStackFrameImpl.java Mon Nov  2 10:58:10 2009
@@ -1,18 +1,21 @@
 package org.apache.kato.hprof.java;
 
 import java.util.LinkedList;
-import java.util.List;
 
+import javax.tools.diagnostics.QueryResult;
 import javax.tools.diagnostics.image.CorruptDataException;
 import javax.tools.diagnostics.image.DataUnavailable;
 import javax.tools.diagnostics.image.ImagePointer;
 import javax.tools.diagnostics.image.DiagnosticException;
+import javax.tools.diagnostics.image.ImageSection;
 import javax.tools.diagnostics.runtime.java.JVMClass;
 import javax.tools.diagnostics.runtime.java.JVMLocation;
 import javax.tools.diagnostics.runtime.java.JVMMethod;
+import javax.tools.diagnostics.runtime.java.JVMReference;
 import javax.tools.diagnostics.runtime.java.JVMStackFrame;
 import javax.tools.diagnostics.runtime.java.JVMVariable;
 
+import org.apache.kato.common.EmptyQueryResult;
 import org.apache.kato.hprof.IJavaStackFrame;
 import org.apache.kato.hprof.image.ImagePointerImpl;
 
@@ -41,7 +44,7 @@
 	}
 
 	@Override
-	public List getHeapRoots() {
+	public QueryResult<JVMReference> getHeapRoots() {
 		// TODO Need implementation here.
 		return null;
 	}
@@ -139,8 +142,8 @@
 		 * @return empty Iterator
 		 */
 		@Override
-		public List getBytecodeSections() {			
-			return new LinkedList();
+		public QueryResult<ImageSection> getBytecodeSections() {			
+			return new EmptyQueryResult<ImageSection>();
 		}
 
 		/**
@@ -148,8 +151,8 @@
 		 * @return empty Iterator
 		 */
 		@Override
-		public List getCompiledSections() {
-			return new LinkedList();
+		public QueryResult<ImageSection> getCompiledSections() {
+			return new EmptyQueryResult<ImageSection>();
 		}
 
 		@Override
@@ -213,8 +216,8 @@
 		}
 
 		@Override
-		public List<JVMVariable> getVariables()  {
-			return new LinkedList<JVMVariable>();
+		public QueryResult<JVMVariable> getVariables()  {
+			return new EmptyQueryResult<JVMVariable>();
 		}
 	}
 
@@ -225,9 +228,10 @@
 	}
 
 	@Override
-	public List getVariables() {
+	public QueryResult<JVMVariable> getVariables() {
+		
+		return new EmptyQueryResult<JVMVariable>();
 		
-		return new LinkedList();
 	}
 	
 }

Modified: incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaSyntheticPrimitiveArrayImpl.java
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaSyntheticPrimitiveArrayImpl.java?rev=831858&r1=831857&r2=831858&view=diff
==============================================================================
--- incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaSyntheticPrimitiveArrayImpl.java (original)
+++ incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaSyntheticPrimitiveArrayImpl.java Mon Nov  2 10:58:10 2009
@@ -14,13 +14,18 @@
 package org.apache.kato.hprof.java;
 
 import java.util.LinkedList;
-import java.util.List;
 
+import javax.tools.diagnostics.QueryResult;
 import javax.tools.diagnostics.image.CorruptDataException;
 import javax.tools.diagnostics.image.ImagePointer;
 import javax.tools.diagnostics.runtime.java.JVMClass;
 import javax.tools.diagnostics.runtime.java.JVMClassLoader;
+import javax.tools.diagnostics.runtime.java.JVMField;
+import javax.tools.diagnostics.runtime.java.JVMMethod;
 import javax.tools.diagnostics.runtime.java.JVMObject;
+import javax.tools.diagnostics.runtime.java.JVMReference;
+
+import org.apache.kato.common.EmptyQueryResult;
 
 
 /**
@@ -47,24 +52,24 @@
 		return componentType;
 	}
 
-	public List getConstantPoolReferences() {
-		return new LinkedList();
+	public QueryResult<JVMObject> getConstantPoolReferences() {
+		return new EmptyQueryResult<JVMObject>();
 	}
 
-	public List getDeclaredFields() {
-		return new LinkedList();
+	public QueryResult<JVMField> getDeclaredFields() {
+		return new EmptyQueryResult<JVMField>();
 	}
 
-	public List getDeclaredMethods() {
-		return new LinkedList();
+	public QueryResult<JVMMethod> getDeclaredMethods() {
+		return new EmptyQueryResult<JVMMethod>();
 	}
 
 	public ImagePointer getID() {
 		return componentType.getID();
 	}
 
-	public List getInterfaces() {
-		return new LinkedList();
+	public QueryResult<String> getInterfaces() {
+		return new EmptyQueryResult<String>();
 	}
 
 	public int getModifiers() throws CorruptDataException {
@@ -79,8 +84,8 @@
 		return null;
 	}
 
-	public List getReferences() {
-		return new LinkedList();
+	public QueryResult<JVMReference> getReferences() {
+		return new EmptyQueryResult<JVMReference>();
 	}
 
 	public JavaClassImpl getSuperclass() throws CorruptDataException {

Modified: incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaThreadImpl.java
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaThreadImpl.java?rev=831858&r1=831857&r2=831858&view=diff
==============================================================================
--- incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaThreadImpl.java (original)
+++ incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/main/java/org/apache/kato/hprof/java/JavaThreadImpl.java Mon Nov  2 10:58:10 2009
@@ -15,15 +15,19 @@
 
 import java.util.LinkedList;
 import java.util.List;
-import java.util.Vector;
 
+import javax.tools.diagnostics.QueryResult;
 import javax.tools.diagnostics.image.CorruptDataException;
 import javax.tools.diagnostics.image.DataUnavailable;
 import javax.tools.diagnostics.image.ImagePointer;
+import javax.tools.diagnostics.image.ImageSection;
 import javax.tools.diagnostics.image.ImageThread;
 import javax.tools.diagnostics.runtime.java.JVMObject;
+import javax.tools.diagnostics.runtime.java.JVMStackFrame;
 import javax.tools.diagnostics.runtime.java.JVMThread;
 
+import org.apache.kato.common.EmptyQueryResult;
+import org.apache.kato.common.ListBackedQueryResult;
 import org.apache.kato.hprof.IJavaStack;
 import org.apache.kato.hprof.IJavaStackFrame;
 import org.apache.kato.hprof.IJavaThread;
@@ -89,20 +93,20 @@
 	 * 
 	 * @return Iterator over all stack frames
 	 */
-	private Vector<JavaStackFrameImpl> frames;
+	private List<JVMStackFrame> frames;
 	@Override
-	public List getStackFrames() {
+	public QueryResult<JVMStackFrame> getStackFrames() {
 		if(frames == null) {
 			IJavaStack stack =thread.getStack();
 		 	IJavaStackFrame[] stackFrames = stack.getStack();
-		 	frames = new Vector<JavaStackFrameImpl>(stackFrames.length);
+		 	frames = new LinkedList<JVMStackFrame>();
 
 		 	for (IJavaStackFrame frame : stackFrames) {
 		 		frames.add(new JavaStackFrameImpl(heap, frame));
 		 	}
 		}
 		
-		return frames;
+		return new ListBackedQueryResult<JVMStackFrame>( frames);
 	}
 
 	/**
@@ -111,8 +115,8 @@
 	 * @return empty iterator.
 	 */
 	@Override
-	public List getStackSections() {
-		return new LinkedList();
+	public QueryResult<ImageSection> getStackSections() {
+		return new EmptyQueryResult<ImageSection>();
 	}
 
 	/**

Modified: incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/test/java/test/apache/kato/hprof/java/TestJavaRuntime.java
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/test/java/test/apache/kato/hprof/java/TestJavaRuntime.java?rev=831858&r1=831857&r2=831858&view=diff
==============================================================================
--- incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/test/java/test/apache/kato/hprof/java/TestJavaRuntime.java (original)
+++ incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.api/src/test/java/test/apache/kato/hprof/java/TestJavaRuntime.java Mon Nov  2 10:58:10 2009
@@ -18,13 +18,20 @@
 import java.util.Iterator;
 import java.util.List;
 
+import javax.tools.diagnostics.QueryResult;
 import javax.tools.diagnostics.image.CorruptDataException;
 import javax.tools.diagnostics.image.DataUnavailable;
 import javax.tools.diagnostics.image.ImagePointer;
 import javax.tools.diagnostics.image.MemoryAccessException;
+import javax.tools.diagnostics.runtime.java.JVMClassLoader;
+import javax.tools.diagnostics.runtime.java.JVMHeap;
+import javax.tools.diagnostics.runtime.java.JVMMethod;
+import javax.tools.diagnostics.runtime.java.JVMMonitor;
 import javax.tools.diagnostics.runtime.java.JVMObject;
+import javax.tools.diagnostics.runtime.java.JVMReference;
 import javax.tools.diagnostics.runtime.java.JVMRuntime;
 import javax.tools.diagnostics.runtime.java.JVMInitArgs;
+import javax.tools.diagnostics.runtime.java.JVMThread;
 
 
 import test.apache.kato.hprof.image.AbstractHProfTestCase;
@@ -106,25 +113,25 @@
 	}
 	private final class MockJavaRuntime implements JVMRuntime {
 		@Override
-		public List getCompiledMethods() {
+		public QueryResult<JVMMethod> getCompiledMethods() {
 
 			return null;
 		}
 
 		@Override
-		public List getHeapRoots() {
+		public QueryResult<JVMReference> getHeapRoots() {
 
 			return null;
 		}
 
 		@Override
-		public List getHeaps() {
+		public QueryResult<JVMHeap> getHeaps() {
 
 			return null;
 		}
 
 		@Override
-		public List getJavaClassLoaders() {
+		public QueryResult<JVMClassLoader> getJavaClassLoaders() {
 
 			return null;
 		}
@@ -143,7 +150,7 @@
 		}
 
 		@Override
-		public List getMonitors() {
+		public QueryResult<JVMMonitor> getMonitors() {
 
 			return null;
 		}
@@ -157,7 +164,7 @@
 		}
 
 		@Override
-		public List getThreads() {
+		public QueryResult<JVMThread> getThreads() {
 
 			return null;
 		}

Modified: incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.reader/src/main/java/org/apache/kato/hprof/HProfView.java
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.reader/src/main/java/org/apache/kato/hprof/HProfView.java?rev=831858&r1=831857&r2=831858&view=diff
==============================================================================
--- incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.reader/src/main/java/org/apache/kato/hprof/HProfView.java (original)
+++ incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.reader/src/main/java/org/apache/kato/hprof/HProfView.java Mon Nov  2 10:58:10 2009
@@ -14,12 +14,11 @@
 package org.apache.kato.hprof;
 
 import java.io.File;
-import java.io.IOException;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedList;
-import java.util.Vector;
+import java.util.List;
 
 import org.apache.kato.common.BasicType;
 import org.apache.kato.common.ClassSummary;
@@ -502,7 +501,7 @@
 	 */
 	private class JavaClassLoader implements IJavaClassLoader {
 		private Long id;
-		private Vector<Long> classes = new Vector<Long>();
+		private List<Long> classes = new LinkedList<Long>();
 		
 		/**
 		 * Creates a JavaClassLoader.
@@ -531,7 +530,7 @@
 			this.classes.add(ID);
 		}
 		
-		public Vector<Long> getClasses() {
+		public List<Long> getClasses() {
 			return classes;
 		}
 	}

Modified: incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.reader/src/main/java/org/apache/kato/hprof/IJavaClassLoader.java
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.reader/src/main/java/org/apache/kato/hprof/IJavaClassLoader.java?rev=831858&r1=831857&r2=831858&view=diff
==============================================================================
--- incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.reader/src/main/java/org/apache/kato/hprof/IJavaClassLoader.java (original)
+++ incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.hprof.reader/src/main/java/org/apache/kato/hprof/IJavaClassLoader.java Mon Nov  2 10:58:10 2009
@@ -13,7 +13,7 @@
  ******************************************************************************/
 package org.apache.kato.hprof;
 
-import java.util.Collection;
+import java.util.List;
 
 /**
  * Represents a class loader. Is created by HProfView.
@@ -32,5 +32,5 @@
 	 * 
 	 * @return Collection<IJavaClass> classes defined by this class loader.
 	 */
-	public abstract Collection<Long> getClasses();
+	public abstract List<Long> getClasses();
 }

Modified: incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jdi/src/main/java/org/apache/kato/tools/jdi/KatoReader.java
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jdi/src/main/java/org/apache/kato/tools/jdi/KatoReader.java?rev=831858&r1=831857&r2=831858&view=diff
==============================================================================
--- incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jdi/src/main/java/org/apache/kato/tools/jdi/KatoReader.java (original)
+++ incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jdi/src/main/java/org/apache/kato/tools/jdi/KatoReader.java Mon Nov  2 10:58:10 2009
@@ -513,10 +513,16 @@
 				while ( runTimesIt.hasNext( ) )
 				{
 					JVMRuntime javaRT = (JVMRuntime) runTimesIt.next( );
-					List<JVMMonitor> jms = javaRT.getMonitors();
+					QueryResult<JVMMonitor> jms = javaRT.getMonitors();
 					for (JVMMonitor jm: jms){
 						monitors.put(jm.getObject().getID().getAddress(), jm);
 					}
+					try {
+						jms.dispose();
+					} catch (IOException e) {
+						// TODO Auto-generated catch block
+						e.printStackTrace();
+					}
 				}
 			}
 		}
@@ -1954,11 +1960,11 @@
 									if (getMethodId(refType, jMethod) == methodID && jClass.getID().getAddress() == refType){
 										Vector<Byte> vctr = new Vector<Byte>();
 
-										List vars = jMethod.getVariables();
+										QueryResult<JVMVariable> vars = jMethod.getVariables();
 										String sig = jMethod.getSignature();
 										
 										addIntToVector(vctr, methodSignatureSize(sig)); 
-										addIntToVector(vctr, vars.size());
+										addIntToVector(vctr, (int) vars.size());
 
 										logr.log(JDILogger.LEVEL_VERYVERBOSE, " "+jLocation+
 												" vars.size="+vars.size()); 
@@ -1985,7 +1991,7 @@
 										}
 										ReplyPacket rpckt = new ReplyPacket(cpckt.getSequence(), FLAG_REPLY_PACKET, ERROR_NONE);
 										rpckt.setData(vectorToByte(vctr));
-
+										vars.dispose();
 										return rpckt;
 									}								
 								}
@@ -2413,7 +2419,7 @@
 					addLongToVector(vctr, 0);
 				}
 				addIntToVector(vctr, 1);
-				addIntToVector(vctr, jm.getEnterWaiters().size());
+				addIntToVector(vctr, (int) jm.getEnterWaiters().size());
 				for (JVMThread thr : jm.getEnterWaiters()){
 					addLongToVector(vctr, thr.getJNIEnv().getAddress());
 				}

Modified: incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jvmti/src/main/java/org/apache/kato/jvmti/javaruntime/JavaRuntimeImpl.java
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jvmti/src/main/java/org/apache/kato/jvmti/javaruntime/JavaRuntimeImpl.java?rev=831858&r1=831857&r2=831858&view=diff
==============================================================================
--- incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jvmti/src/main/java/org/apache/kato/jvmti/javaruntime/JavaRuntimeImpl.java (original)
+++ incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jvmti/src/main/java/org/apache/kato/jvmti/javaruntime/JavaRuntimeImpl.java Mon Nov  2 10:58:10 2009
@@ -17,15 +17,21 @@
 import java.io.File;
 import java.io.IOException;
 import java.util.LinkedList;
-import java.util.List;
 
+import javax.tools.diagnostics.QueryResult;
 import javax.tools.diagnostics.image.CorruptDataException;
 import javax.tools.diagnostics.image.DataUnavailable;
 import javax.tools.diagnostics.image.ImagePointer;
 import javax.tools.diagnostics.image.MemoryAccessException;
+import javax.tools.diagnostics.runtime.java.JVMClassLoader;
+import javax.tools.diagnostics.runtime.java.JVMHeap;
+import javax.tools.diagnostics.runtime.java.JVMMethod;
+import javax.tools.diagnostics.runtime.java.JVMMonitor;
 import javax.tools.diagnostics.runtime.java.JVMObject;
+import javax.tools.diagnostics.runtime.java.JVMReference;
 import javax.tools.diagnostics.runtime.java.JVMRuntime;
 import javax.tools.diagnostics.runtime.java.JVMInitArgs;
+import javax.tools.diagnostics.runtime.java.JVMThread;
 
 import org.apache.kato.jvmti.javaruntime.model.Model;
 
@@ -40,22 +46,22 @@
 	}
 	
 	@Override
-	public List getCompiledMethods() {
+	public QueryResult<JVMMethod> getCompiledMethods() {
 		return new LinkedList();
 	}
 
 	@Override
-	public List getHeapRoots() {
+	public QueryResult<JVMReference> getHeapRoots() {
 		return new LinkedList();
 	}
 
 	@Override
-	public List getHeaps() {
+	public QueryResult<JVMHeap> getHeaps() {
 		return new LinkedList();
 	}
 
 	@Override
-	public List getJavaClassLoaders() {
+	public QueryResult<JVMClassLoader> getJavaClassLoaders() {
 		
 		return base.getJavaClassLoader();
 	}
@@ -73,7 +79,7 @@
 	}
 
 	@Override
-	public List getMonitors() {
+	public QueryResult<JVMMonitor> getMonitors() {
 		
 		return base.getJavaMonitors();
 	}
@@ -86,7 +92,7 @@
 	}
 
 	@Override
-	public List getThreads() {
+	public QueryResult<JVMThread> getThreads() {
 		
 		return base.getThreads();
 	}

Modified: incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JClass.java
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JClass.java?rev=831858&r1=831857&r2=831858&view=diff
==============================================================================
--- incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JClass.java (original)
+++ incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JClass.java Mon Nov  2 10:58:10 2009
@@ -6,12 +6,18 @@
 import java.util.LinkedList;
 import java.util.List;
 
+import javax.tools.diagnostics.QueryResult;
 import javax.tools.diagnostics.image.CorruptDataException;
 import javax.tools.diagnostics.image.ImagePointer;
 import javax.tools.diagnostics.runtime.java.JVMClass;
 import javax.tools.diagnostics.runtime.java.JVMClassLoader;
+import javax.tools.diagnostics.runtime.java.JVMField;
+import javax.tools.diagnostics.runtime.java.JVMMethod;
 import javax.tools.diagnostics.runtime.java.JVMObject;
+import javax.tools.diagnostics.runtime.java.JVMReference;
 
+import org.apache.kato.common.EmptyQueryResult;
+import org.apache.kato.common.ListBackedQueryResult;
 import org.apache.kato.common.ObjectMapList;
 
 
@@ -36,9 +42,9 @@
 	public short methodsCount=0;
 	public int   nameLength=0; 
 	public String classSig=null;
-		private List<JClass> interfaces=null;
-		private List<JMethod> methods=null;
-		private ObjectMapList<Integer, JField> fields=null;
+		private List<JVMClass> interfaces=null;
+		private List<JVMMethod> methods=null;
+		private ObjectMapList<Integer, JVMField> fields=null;
 		
 		@Override
 		public JVMClassLoader getClassLoader() throws CorruptDataException {
@@ -47,14 +53,14 @@
 		}
 		public void addInterface(JClass face) {
 			if(interfaces==null) {
-				interfaces=new LinkedList<JClass>();
+				interfaces=new LinkedList<JVMClass>();
 			}
 			interfaces.add(face);
 			
 		}
 		public void addMethod(JMethod m) {
 			if(methods==null) {
-				methods=new LinkedList<JMethod>();
+				methods=new LinkedList<JVMMethod>();
 			}
 			m.setParent(this);
 			methods.add(m);
@@ -66,21 +72,21 @@
 			return null;
 		}
 		@Override
-		public List getConstantPoolReferences() {
-			return new LinkedList();
+		public QueryResult<JVMObject> getConstantPoolReferences() {
+			return new EmptyQueryResult<JVMObject>();
 			
 		}
 		@Override
-		public List getDeclaredFields() {
+		public QueryResult<JVMField> getDeclaredFields() {
 			
-			if(fields==null) fields=new ObjectMapList<Integer, JField>();
+			if(fields==null) fields=new ObjectMapList<Integer, JVMField>();
 			System.out.println("asking for fields "+fields);
-			return fields.values();
+			return new ListBackedQueryResult<JVMField>( fields.values());
 		}
 		@Override
-		public List getDeclaredMethods() {
-			if(methods==null) methods=new LinkedList<JMethod>();
-			return methods;
+		public QueryResult<JVMMethod> getDeclaredMethods() {
+			if(methods==null)return new EmptyQueryResult<JVMMethod>();
+			return new ListBackedQueryResult<JVMMethod>(methods);
 		}
 		@Override
 		public ImagePointer getID() {
@@ -88,9 +94,9 @@
 			return new SimpleImagePointer(classid); 
 		}
 		@Override
-		public List getInterfaces() {
+		public QueryResult<String> getInterfaces() {
 			
-			return new LinkedList();
+			return new EmptyQueryResult<String>();
 		}
 		@Override
 		public int getModifiers() throws CorruptDataException {
@@ -108,8 +114,8 @@
 			return null;
 		}
 		@Override
-		public List getReferences() {
-			return new LinkedList();
+		public QueryResult<JVMReference> getReferences() {
+			return new EmptyQueryResult<JVMReference>();
 		}
 		@Override
 		public JVMClass getSuperclass() throws CorruptDataException {
@@ -124,15 +130,15 @@
 		public JField getField(int id) {
 			
 			if(fields==null) {
-				fields=new ObjectMapList<Integer, JField>();
+				fields=new ObjectMapList<Integer, JVMField>();
 			}
 			
-			JField f=fields.get(id);
+			JVMField f=fields.get(id);
 			if(f==null) {
 				f=new JField(this,id);
 				fields.put(id, f);
 			}
-			return f;
+			return (JField) f;
 			
 			
 		}

Modified: incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JClassLoader.java
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JClassLoader.java?rev=831858&r1=831857&r2=831858&view=diff
==============================================================================
--- incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JClassLoader.java (original)
+++ incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JClassLoader.java Mon Nov  2 10:58:10 2009
@@ -6,11 +6,15 @@
 import java.util.LinkedList;
 import java.util.List;
 
+import javax.tools.diagnostics.QueryResult;
 import javax.tools.diagnostics.image.CorruptDataException;
 import javax.tools.diagnostics.runtime.java.JVMClass;
 import javax.tools.diagnostics.runtime.java.JVMClassLoader;
 import javax.tools.diagnostics.runtime.java.JVMObject;
 
+import org.apache.kato.common.EmptyQueryResult;
+import org.apache.kato.common.ListBackedQueryResult;
+
 
 public class JClassLoader implements JVMClassLoader {
 
@@ -29,14 +33,15 @@
 	}
 
 	@Override
-	public List getCachedClasses() {
-		return new LinkedList();
+	public QueryResult<JVMClass> getCachedClasses() {
+		return new EmptyQueryResult<JVMClass>();
+		
 	}
 
 	@Override
-	public List getDefinedClasses() {
+	public QueryResult<JVMClass> getDefinedClasses() {
 		if(classes==null) classes=new LinkedList<JVMClass>();
-		return classes;
+		return new ListBackedQueryResult<JVMClass>( classes);
 	}
 
 	@Override

Modified: incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JMethod.java
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JMethod.java?rev=831858&r1=831857&r2=831858&view=diff
==============================================================================
--- incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JMethod.java (original)
+++ incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JMethod.java Mon Nov  2 10:58:10 2009
@@ -4,14 +4,16 @@
 package org.apache.kato.jvmti.javaruntime.model;
 
 import java.util.LinkedList;
-import java.util.List;
 
+import javax.tools.diagnostics.QueryResult;
 import javax.tools.diagnostics.image.CorruptDataException;
 import javax.tools.diagnostics.image.DataUnavailable;
+import javax.tools.diagnostics.image.ImageSection;
 import javax.tools.diagnostics.runtime.java.JVMClass;
 import javax.tools.diagnostics.runtime.java.JVMMethod;
 import javax.tools.diagnostics.runtime.java.JVMVariable;
 
+import org.apache.kato.common.EmptyQueryResult;
 import org.apache.kato.common.ObjectMapList;
 
 
@@ -46,13 +48,13 @@
 	}
 
 	@Override
-	public List getBytecodeSections() {
+	public QueryResult<ImageSection> getBytecodeSections() {
 	
-		return new LinkedList();
+		return new EmptyQueryResult<ImageSection>();
 	}
 
 	@Override
-	public List getCompiledSections() {
+	public QueryResult<ImageSection> getCompiledSections() {
 		return new LinkedList();
 	}
 
@@ -80,7 +82,7 @@
 	}
 
 	@Override
-	public List<JVMVariable> getVariables() {
+	public QueryResult<JVMVariable> getVariables() {
 		if(localVars==null) {
 			localVars=new ObjectMapList<Integer, JVMVariable>();
 		}

Modified: incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JMonitor.java
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JMonitor.java?rev=831858&r1=831857&r2=831858&view=diff
==============================================================================
--- incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JMonitor.java (original)
+++ incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JMonitor.java Mon Nov  2 10:58:10 2009
@@ -6,14 +6,17 @@
 import java.util.LinkedList;
 import java.util.List;
 
+import javax.tools.diagnostics.QueryResult;
 import javax.tools.diagnostics.image.CorruptDataException;
 import javax.tools.diagnostics.image.DataUnavailable;
 import javax.tools.diagnostics.image.ImagePointer;
+import javax.tools.diagnostics.image.ImageSection;
 import javax.tools.diagnostics.image.MemoryAccessException;
 import javax.tools.diagnostics.runtime.java.JVMClass;
 import javax.tools.diagnostics.runtime.java.JVMHeap;
 import javax.tools.diagnostics.runtime.java.JVMMonitor;
 import javax.tools.diagnostics.runtime.java.JVMObject;
+import javax.tools.diagnostics.runtime.java.JVMReference;
 import javax.tools.diagnostics.runtime.java.JVMThread;
 
 
@@ -28,7 +31,7 @@
 	}
 
 	@Override
-	public List getEnterWaiters() {
+	public QueryResult<JVMThread> getEnterWaiters() {
 		
 		return waiters;
 	}
@@ -51,7 +54,7 @@
 	}
 
 	@Override
-	public List getNotifyWaiters() {
+	public QueryResult<JVMThread> getNotifyWaiters() {
 		// TODO Auto-generated method stub
 		return null;
 	}
@@ -108,13 +111,13 @@
 			}
 
 			@Override
-			public List getReferences() {
+			public QueryResult<JVMReference> getReferences() {
 				// TODO Auto-generated method stub
 				return null;
 			}
 
 			@Override
-			public List getSections() {
+			public QueryResult<ImageSection> getSections() {
 				// TODO Auto-generated method stub
 				return null;
 			}

Modified: incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JObject.java
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JObject.java?rev=831858&r1=831857&r2=831858&view=diff
==============================================================================
--- incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JObject.java (original)
+++ incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JObject.java Mon Nov  2 10:58:10 2009
@@ -5,16 +5,18 @@
 
 import java.util.HashMap;
 import java.util.LinkedList;
-import java.util.List;
 import java.util.Map;
 
+import javax.tools.diagnostics.QueryResult;
 import javax.tools.diagnostics.image.CorruptDataException;
 import javax.tools.diagnostics.image.DataUnavailable;
 import javax.tools.diagnostics.image.ImagePointer;
+import javax.tools.diagnostics.image.ImageSection;
 import javax.tools.diagnostics.image.MemoryAccessException;
 import javax.tools.diagnostics.runtime.java.JVMClass;
 import javax.tools.diagnostics.runtime.java.JVMHeap;
 import javax.tools.diagnostics.runtime.java.JVMObject;
+import javax.tools.diagnostics.runtime.java.JVMReference;
 
 
 public class JObject implements JVMObject {
@@ -130,12 +132,12 @@
 	}
 
 	@Override
-	public List getReferences() {
+	public QueryResult<JVMReference> getReferences() {
 		return new LinkedList();
 	}
 
 	@Override
-	public List getSections() {
+	public QueryResult<ImageSection> getSections() {
 		
 		return new LinkedList();
 	}

Modified: incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JStackFrame.java
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JStackFrame.java?rev=831858&r1=831857&r2=831858&view=diff
==============================================================================
--- incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JStackFrame.java (original)
+++ incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JStackFrame.java Mon Nov  2 10:58:10 2009
@@ -4,12 +4,13 @@
 package org.apache.kato.jvmti.javaruntime.model;
 
 import java.util.LinkedList;
-import java.util.List;
 
+import javax.tools.diagnostics.QueryResult;
 import javax.tools.diagnostics.image.CorruptDataException;
 import javax.tools.diagnostics.image.DataUnavailable;
 import javax.tools.diagnostics.image.ImagePointer;
 import javax.tools.diagnostics.runtime.java.JVMLocation;
+import javax.tools.diagnostics.runtime.java.JVMReference;
 import javax.tools.diagnostics.runtime.java.JVMStackFrame;
 import javax.tools.diagnostics.runtime.java.JVMVariable;
 
@@ -30,7 +31,7 @@
 		this.location=loc;
 	}
 	@Override
-	public List getHeapRoots() {
+	public QueryResult<JVMReference> getHeapRoots() {
 		return new LinkedList();
 	}
 
@@ -55,7 +56,7 @@
 	}
 
 	@Override
-	public List<JVMVariable> getVariables() {
+	public QueryResult<JVMVariable> getVariables() {
 		
 		return vars.values();
 	}

Modified: incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JThread.java
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JThread.java?rev=831858&r1=831857&r2=831858&view=diff
==============================================================================
--- incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JThread.java (original)
+++ incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.jvmti/src/main/java/org/apache/kato/jvmti/javaruntime/model/JThread.java Mon Nov  2 10:58:10 2009
@@ -6,15 +6,18 @@
 import java.util.LinkedList;
 import java.util.List;
 
+import javax.tools.diagnostics.QueryResult;
 import javax.tools.diagnostics.image.CorruptDataException;
 import javax.tools.diagnostics.image.DataUnavailable;
 import javax.tools.diagnostics.image.ImagePointer;
+import javax.tools.diagnostics.image.ImageSection;
 import javax.tools.diagnostics.image.ImageThread;
 import javax.tools.diagnostics.image.MemoryAccessException;
 import javax.tools.diagnostics.runtime.java.JVMClass;
 import javax.tools.diagnostics.runtime.java.JVMHeap;
 import javax.tools.diagnostics.runtime.java.JVMMonitor;
 import javax.tools.diagnostics.runtime.java.JVMObject;
+import javax.tools.diagnostics.runtime.java.JVMReference;
 import javax.tools.diagnostics.runtime.java.JVMStackFrame;
 import javax.tools.diagnostics.runtime.java.JVMThread;
 
@@ -119,13 +122,13 @@
 			}
 
 			@Override
-			public List getReferences() {
+			public QueryResult<JVMReference> getReferences() {
 				// TODO Auto-generated method stub
 				return null;
 			}
 
 			@Override
-			public List getSections() {
+			public QueryResult<ImageSection> getSections() {
 				// TODO Auto-generated method stub
 				return null;
 			}
@@ -150,11 +153,11 @@
 		return priority;
 	}
 	@Override
-	public List getStackFrames() {
+	public QueryResult<JVMStackFrame> getStackFrames() {
 		return frames;
 	}
 	@Override
-	public List getStackSections() {
+	public QueryResult<ImageSection> getStackSections() {
 		// TODO Auto-generated method stub
 		return null;
 	}

Modified: incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaRuntimeThreads.java
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaRuntimeThreads.java?rev=831858&r1=831857&r2=831858&view=diff
==============================================================================
--- incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaRuntimeThreads.java (original)
+++ incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaRuntimeThreads.java Mon Nov  2 10:58:10 2009
@@ -13,10 +13,12 @@
  ******************************************************************************/
 package org.apache.kato.tck.tests.javaruntime;
 
+import java.io.IOException;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 
+import javax.tools.diagnostics.QueryResult;
 import javax.tools.diagnostics.image.CorruptDataException;
 import javax.tools.diagnostics.runtime.java.JVMLocation;
 import javax.tools.diagnostics.runtime.java.JVMMethod;
@@ -74,54 +76,58 @@
 	/**
 	 * Test has configured threads
 	 * @throws CorruptDataException 
+	 * @throws IOException 
 	 * 
 	 */
 	
-	public void testHasExpectedThreads() throws CorruptDataException {
+	public void testHasExpectedThreads() throws CorruptDataException, IOException {
 		
-		List allThreads = getJavaRuntime().getThreads();
+		QueryResult<JVMThread> allThreads = getJavaRuntime().getThreads();
 		
 		assertNotNull(getThread(allThreads,DTFJ_TCK_T1));
 		assertNotNull(getThread(allThreads,DTFJ_TCK_T2));
 		assertNotNull(getThread(allThreads,DTFJ_TCK_T3));
-		
+	
+		allThreads.dispose();
 	}
 
-	public void testExpectedThreadState() throws CorruptDataException {
+	public void testExpectedThreadState() throws CorruptDataException, IOException {
 		
-		List allThreads = getJavaRuntime().getThreads();
+		QueryResult<JVMThread> allThreads = getJavaRuntime().getThreads();
 		
 		JVMThread t1=getThread(allThreads,DTFJ_TCK_T1);
 		int state=t1.getState();
 		assertEquals(JVMThread.STATE_ALIVE | JVMThread.STATE_WAITING | JVMThread.STATE_SLEEPING,state);
 		
+		allThreads.dispose();
 	}
 	
-	public void testHasThreadStack() throws CorruptDataException {
+	public void testHasThreadStack() throws CorruptDataException, IOException {
 		
-		List allThreads = getJavaRuntime().getThreads();
+		QueryResult<JVMThread> allThreads = getJavaRuntime().getThreads();
 		
 		JVMThread t1=getThread(allThreads,DTFJ_TCK_T1);
 		Iterator i=t1.getStackFrames().iterator();
 		assertTrue(i.hasNext());
-		
+		allThreads.dispose();
 		
 	}
-	public void testThreadStackFrameLocation() throws CorruptDataException {
+	public void testThreadStackFrameLocation() throws CorruptDataException, IOException {
 		
-		List allThreads = getJavaRuntime().getThreads();
+		QueryResult<JVMThread> allThreads = getJavaRuntime().getThreads();
 		
 		JVMThread t1=getThread(allThreads,DTFJ_TCK_T1);
 		Iterator i=t1.getStackFrames().iterator();
 		JVMStackFrame frame=(JVMStackFrame) i.next();
 		JVMLocation location=frame.getLocation();
 		assertNotNull(location);
+		allThreads.dispose();
 		
 		
 	}
-	public void testThreadStackFrameLocationMethod() throws CorruptDataException {
+	public void testThreadStackFrameLocationMethod() throws CorruptDataException, IOException {
 		
-		List allThreads = getJavaRuntime().getThreads();
+		QueryResult<JVMThread> allThreads = getJavaRuntime().getThreads();
 		
 		JVMThread t1=getThread(allThreads,DTFJ_TCK_T1);
 		Iterator i=t1.getStackFrames().iterator();
@@ -129,12 +135,12 @@
 		JVMLocation location=frame.getLocation();
 		JVMMethod  method=location.getMethod();
 		assertNotNull(method);
-		
+		allThreads.dispose();
 		
 	}
-public void testThreadStackFrameLocationMethodName() throws CorruptDataException {
+public void testThreadStackFrameLocationMethodName() throws CorruptDataException, IOException {
 		
-		List allThreads = getJavaRuntime().getThreads();
+	QueryResult<JVMThread> allThreads = getJavaRuntime().getThreads();
 		
 		JVMThread t1=getThread(allThreads,DTFJ_TCK_T1);
 		Iterator i=t1.getStackFrames().iterator();
@@ -144,7 +150,7 @@
 		String name=method.getName();
 		assertEquals(name,"sleep");
 		
-		
+		allThreads.dispose();
 		
 	}
 
@@ -162,20 +168,22 @@
 	}
 
 	 
-	public void testThreadGroupMembership() throws CorruptDataException {
+	public void testThreadGroupMembership() throws CorruptDataException, IOException {
 		
-		List allThreads = getJavaRuntime().getThreads();
+		QueryResult<JVMThread> allThreads = getJavaRuntime().getThreads();
 		JVMThread t1=getThread(allThreads, DTFJ_TCK_T1);
-		
+		allThreads.dispose();
 		
 	}
-	private JVMThread getThread(List allThreads, String threadname) throws CorruptDataException {
+	private JVMThread getThread(QueryResult<JVMThread> allThreads, String threadname) throws CorruptDataException {
 		
-		Iterator i=allThreads.iterator();
+		Iterator<JVMThread> i=allThreads.iterator();
 		while(i.hasNext()) {
-			JVMThread thread=(JVMThread) i.next();
+			JVMThread thread= i.next();
 			String name=thread.getName();
-			if(name.equals(threadname)) return thread;
+			if(name.equals(threadname)) {
+				return thread;
+			}
 		}
 		return null;
 	}

Modified: incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaClassLoaderTest.java
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaClassLoaderTest.java?rev=831858&r1=831857&r2=831858&view=diff
==============================================================================
--- incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaClassLoaderTest.java (original)
+++ incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaClassLoaderTest.java Mon Nov  2 10:58:10 2009
@@ -13,8 +13,10 @@
  ******************************************************************************/
 package org.apache.kato.tests.junit;
 
+import java.io.IOException;
 import java.util.Iterator;
 
+import javax.tools.diagnostics.QueryResult;
 import javax.tools.diagnostics.image.CorruptDataException;
 import javax.tools.diagnostics.runtime.java.JVMClass;
 import javax.tools.diagnostics.runtime.java.JVMClassLoader;
@@ -53,10 +55,13 @@
 	/**
 	 * 
 	 * Grab any class, then try looking up a class with that name since we know it is there
+	 * @throws IOException 
+	 * @throws IndexOutOfBoundsException 
 	 */
-	public void testFindClass()
+	public void testFindClass() throws IndexOutOfBoundsException, IOException
 	{
-		JVMClass oneClass = (JVMClass) _loader.getDefinedClasses().get(0);
+		QueryResult<JVMClass> classes=_loader.getDefinedClasses();
+		JVMClass oneClass = classes.get(0);
 		try {
 			String name = oneClass.getName();
 			JVMClass foundClass = _loader.findClass(name);
@@ -66,6 +71,7 @@
 			assertTrue(foundClass.equals(oneClass));
 		} catch (CorruptDataException e) {
 		}
+		classes.dispose();
 	}
 
 	/**

Modified: incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaClassTest.java
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaClassTest.java?rev=831858&r1=831857&r2=831858&view=diff
==============================================================================
--- incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaClassTest.java (original)
+++ incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaClassTest.java Mon Nov  2 10:58:10 2009
@@ -13,10 +13,12 @@
  ******************************************************************************/
 package org.apache.kato.tests.junit;
 
+import java.io.IOException;
 import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 
+import javax.tools.diagnostics.QueryResult;
 import javax.tools.diagnostics.image.CorruptData;
 import javax.tools.diagnostics.image.CorruptDataException;
 import javax.tools.diagnostics.image.ImagePointer;
@@ -145,15 +147,13 @@
 	/*
 	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaClass.getInterfaces()'
 	 */
-	public void testGetInterfaces()
+	public void testGetInterfaces() throws IOException
 	{
-		try {
-			List iter = _testClass.getInterfaces();
+		
+			QueryResult<String> iter = _testClass.getInterfaces();
 			assertNotNull(iter);
-		} catch (Exception e) {
-			//if we caught anything else, this is an error
-			fail();
-		}
+			iter.dispose();
+		
 	}
 
 	/*

Modified: incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaFieldTest.java
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaFieldTest.java?rev=831858&r1=831857&r2=831858&view=diff
==============================================================================
--- incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaFieldTest.java (original)
+++ incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaFieldTest.java Mon Nov  2 10:58:10 2009
@@ -13,8 +13,10 @@
  ******************************************************************************/
 package org.apache.kato.tests.junit;
 
+import java.io.IOException;
 import java.util.Iterator;
 
+import javax.tools.diagnostics.QueryResult;
 import javax.tools.diagnostics.image.CorruptDataException;
 import javax.tools.diagnostics.image.MemoryAccessException;
 import javax.tools.diagnostics.runtime.java.JVMClass;
@@ -29,9 +31,12 @@
 	private JVMField _field;
 	private JVMField _anotherField;
 
-	public static JVMField defaultJavaField(JVMClass clazz)
+	public static JVMField defaultJavaField(JVMClass clazz) throws IndexOutOfBoundsException, IOException
 	{
-		return (JVMField) clazz.getDeclaredFields().get(0);
+		QueryResult<JVMField> fields=clazz.getDeclaredFields();
+		JVMField field=fields.get(0);
+		fields.dispose();
+		return field;
 	}
 	
 	protected void setUp() throws Exception

Modified: incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaLocationTest.java
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaLocationTest.java?rev=831858&r1=831857&r2=831858&view=diff
==============================================================================
--- incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaLocationTest.java (original)
+++ incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaLocationTest.java Mon Nov  2 10:58:10 2009
@@ -13,6 +13,9 @@
  ******************************************************************************/
 package org.apache.kato.tests.junit;
 
+import java.io.IOException;
+
+import javax.tools.diagnostics.QueryResult;
 import javax.tools.diagnostics.image.CorruptDataException;
 import javax.tools.diagnostics.image.DataUnavailable;
 import javax.tools.diagnostics.image.ImagePointer;
@@ -23,10 +26,14 @@
 {
 	private JVMLocation _location;
 	
-	public  JVMLocation defaultLocation()
+	public  JVMLocation defaultLocation() throws IndexOutOfBoundsException, IOException
 	{
 		try {
-			return ((JVMStackFrame)defaultJavaThread().getStackFrames().get(0)).getLocation();
+			QueryResult<JVMStackFrame> loc=defaultJavaThread().getStackFrames();
+			JVMStackFrame first=loc.get(0);
+			JVMLocation location=first.getLocation();
+			loc.dispose();
+			return location;
 		} catch (CorruptDataException e) {
 			//XXX: how should this be handled?
 			throw new TestNotImplementedException();

Modified: incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaObjectTest.java
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaObjectTest.java?rev=831858&r1=831857&r2=831858&view=diff
==============================================================================
--- incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaObjectTest.java (original)
+++ incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaObjectTest.java Mon Nov  2 10:58:10 2009
@@ -13,13 +13,16 @@
  ******************************************************************************/
 package org.apache.kato.tests.junit;
 
+import java.io.IOException;
 import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.List;
 
+import javax.tools.diagnostics.QueryResult;
 import javax.tools.diagnostics.image.CorruptData;
 import javax.tools.diagnostics.image.CorruptDataException;
 import javax.tools.diagnostics.image.DataUnavailable;
+import javax.tools.diagnostics.image.ImageSection;
 import javax.tools.diagnostics.image.MemoryAccessException;
 import javax.tools.diagnostics.runtime.java.JVMClass;
 import javax.tools.diagnostics.runtime.java.JVMObject;
@@ -723,13 +726,15 @@
 	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.getSections()'
 	 * 
 	 * Ensures that at least one section is in the returned iterator
+	 * @throws IOException 
 	 */
-	public void testGetSections()
+	public void testGetSections() throws IOException
 	{
-		List sections = _object.getSections();
+		QueryResult<ImageSection> sections = _object.getSections();
 		
 		assertNotNull(sections);
 		assertFalse(sections.isEmpty());
+		sections.dispose();
 	}
 
 	/**

Modified: incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/helpers/KatoSearch.java
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/helpers/KatoSearch.java?rev=831858&r1=831857&r2=831858&view=diff
==============================================================================
--- incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/helpers/KatoSearch.java (original)
+++ incubator/kato/branches/experimental/thirdview/org.apache.kato/kato.tools.katoview/src/main/java/org/apache/kato/katoview/commands/helpers/KatoSearch.java Mon Nov  2 10:58:10 2009
@@ -113,7 +113,7 @@
 	 * @return JavaClass or null if class not found.
 	 */
 	public static JVMClass findClass(JVMRuntime runtime, String name) {
-		List classLoaders = runtime.getJavaClassLoaders();
+		QueryResult<JVMClassLoader> classLoaders = runtime.getJavaClassLoaders();
 
 
 		for (Object nextLoader : classLoaders) {			
@@ -123,7 +123,7 @@
 
 			JVMClassLoader loader = (JVMClassLoader) nextLoader;
 
-			List classes = loader.getDefinedClasses();
+			QueryResult<JVMClass> classes = loader.getDefinedClasses();
 
 			for (Object nextClazz : classes) {
 
@@ -135,13 +135,25 @@
 
 				try {
 					if (name.equals(clazz.getName())) {
+						classLoaders.dispose();
+						classes.dispose();
 						return clazz;
 					}
 				} catch (CorruptDataException e) {
 					// IGNORE
+				} catch (IOException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
 				}
 
 			}
+			try {
+				classLoaders.dispose();
+				classes.dispose();
+			} catch (IOException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
 		}
 		return null;
 	}
@@ -154,7 +166,7 @@
 	 * @throws DiagnosticException 
 	 */
 	public static void visitClasses(JVMRuntime runtime, JavaClassVisitor visitor)  {
-		List classLoaders = runtime.getJavaClassLoaders();
+		QueryResult<JVMClassLoader> classLoaders = runtime.getJavaClassLoaders();
 		
 CLASSLOADERS:
 		for (Object nextLoader : classLoaders) {			
@@ -164,7 +176,7 @@
 			
 			JVMClassLoader loader = (JVMClassLoader) nextLoader;
 			
-			List classes = loader.getDefinedClasses();
+			QueryResult<JVMClass> classes = loader.getDefinedClasses();
 			
 			for (Object nextClazz : classes) {
 				
@@ -182,6 +194,13 @@
 					
 				}
 			}
+			try {
+				classLoaders.dispose();
+				classes.dispose();
+			} catch (IOException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
 		}
 	}
 	
@@ -197,7 +216,7 @@
 	public static JVMField getField(JVMClass clazz, String name)  {
 
 		while(clazz != null) {
-			List fields = clazz.getDeclaredFields();
+			QueryResult<JVMField> fields = clazz.getDeclaredFields();
 
 			for (Object nextField : fields) {
 
@@ -208,18 +227,29 @@
 				JVMField field = (JVMField) nextField;
 				try {
 					if (name.equals(field.getName())) {
+						fields.dispose();
 						return field;
 					}
 				} catch (CorruptDataException e) {
 					// Try again.
+				} catch (IOException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
 				}
 			}
 			try {
+				fields.dispose();
+			} catch (IOException e1) {
+				// TODO Auto-generated catch block
+				e1.printStackTrace();
+			}
+			try {
 				clazz = clazz.getSuperclass();
 			} catch (CorruptDataException e) {
 				break;
 			}
 		}
+		
 		return null;
 	}
 	



Mime
View raw message