From: Jan S. <st...@us...> - 2001-11-17 12:02:21
|
Update of /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl In directory usw-pr-cvs1:/tmp/cvs-serv14381 Added Files: VirtualMachineImpl.java Log Message: First version of VirtualMachineImpl. --- NEW FILE: VirtualMachineImpl.java --- /* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License Version * 1.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is available at http://www.sun.com/ * * The Original Code is the Java Profiler module. * The Initial Developers of the Original Code are Jan Stola, Pavel Vacha, * Michal Pise, Petr Luner, Lukas Petru and Marek Przeczek. * Portions created by Jan Stola are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Pavel Vacha are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Michal Pise are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Petr Luner are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Lukas Petru are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Marek Przeczek are Copyright (C) 2000-2001. All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ package net.sourceforge.javaprofiler.jpiimpl; import java.util.*; import net.sourceforge.javaprofiler.jpi.*; import net.sourceforge.javaprofiler.jpi.dump.HeapDump; import net.sourceforge.javaprofiler.jpi.event.EventQueue; import net.sourceforge.javaprofiler.jpiimpl.commun.*; /** * Implementation of Virtual Machine. * * @see net.sourceforge.javaprofiler.jpi.VirtualMachine * @author Jan Stola */ public class VirtualMachineImpl implements VirtualMachine { private IProf iprof; public VirtualMachineImpl(IProf iprof) { this.iprof=iprof; } /** * Enables/disables the garbage collection in the mirrored virtual machine. * * @param enable if <code>true</code> the garbage collection is enabled * otherwise its disabled. */ public void enableGC(boolean enable) { //PENDING } /** * Returns number of all loaded types by the mirrored virtual machine. * * @return number of all loaded types by the mirrored virtual machine. */ public int getClassCount() { //PENDING return 0; } /** * Performed heap dump of the mirrored virtual machine. * * @return a {@link net.sourceforge.javaprofiler.jpi.dump.HeapDump} object * representing the content of the memory of the mirrored virtual machine. */ public HeapDump dumpHeap() { //PENDING return null; } /** * Returns the <code>Process</code> object for this virtual machine if * launched by a launching connector. * * @return the <code>Process</code> object for this virtual machine, * or <code>null</code> if it was not launched by a launching connector. */ public Process process() { //PENDING return null; } /** * Creates the snapshot of the current profiling information about the mirrored * virtual machine. */ public Snapshot createSnapshot() { //PENDING return null; } /** * Causes the mirrored VM to terminate with the given error code. All * resources associated with this <code>VirtualMachine</code> are freed. * If the mirrored VM is remote, the communication channel to it will be * closed. Resources originating in this <code>VirtualMachine</code> * (<code>ClassInfo</code>, <code>ThreadInfo</code>, etc.) will become invalid. * Threads running in the mirrored VM are abruptly terminated. A thread death * exception is not thrown and finally blocks are not run. * * @param exitCode the exit code for the target VM. */ public void exit(int exitCode) { //PENDING try { iprof.exitVM(); } catch (COMMUN_Exception e) { throw new VMDisconnectedException(); } } /** * Returns size (in bytes) of allocated memory in the mirrored virtual * machine. * * @return size (in bytes) of allocated memory in the mirrored virtual * machine. */ public long totalMemory() { //PENDING return 0; } /** * Suspends all threads in the virtual machine as described in * {@link ThreadInfo#suspend()}. */ public void suspendThreads() { //PENDING try { iprof.suspendVM(); } catch (COMMUN_Exception e) { throw new VMDisconnectedException(); } } /** * Invalidates this virtual machine mirror. The communication channel to the * target VM is closed, and the target VM prepares to accept another * subsequent connection from this profiler or another profiler, including * the following tasks: All threads suspended by {@link ThreadInfo#suspend()} * are resumed. Garbage collection is re-enabled. Any current method * invocations executing in the target VM are continued after * the disconnection. Resources originating in this <code>VirtualMachine</code> * (<code>ClassInfo</code>, <code>ThreadInfo</code>, etc.) will become invalid. */ public void dispose() { //PENDING iprof.stop(); } /** * Returns a list of the currently running threads. For each running thread * in the target VM, a {@link ThreadInfo} that holds information about it * is placed in the list. The returned list contains threads created through * <code>Thread</code>, all native threads attached to the target * VM through JNI, and system threads created by the target VM. * <p>Thread objects that have not yet been started * (through <code>Thread.start()</code>) and thread objects that * have completed their execution are not included in the returned list. * * @return a <code>List</code> of {@link ThreadInfo} objects, one for each * running thread in the mirrored VM. */ public List threads() { //PENDING return null; } /** * Performes monitor dump of the mirrored virtual machine. * A {@link MonitorInfo} object is included for all monitors * existing in the mirrored virtual machine. * * @return a <code>List</code> of {@link MonitorInfo} objects representing * monitors in the mirrored virtual machine. */ public List dumpMonitors() { //PENDING return null; } /** * Resumes all threads in the virtual machine as described in * {@link ThreadInfo#resume()}. */ public void resumeThreads() { //PENDING try { iprof.resumeVM(); } catch (COMMUN_Exception e) { throw new VMDisconnectedException(); } } /** * Returns size (in bytes) of free memory in the mirrored virtual machine. * * @return size (in bytes) of free memory in the mirrored virtual machine. */ public long freeMemory() { //PENDING return 0; } /** * Returns <code>index</code>-th loaded type by the mirrored virtual machine. * * @param index index of some loaded type by the mirrored virtual machine. * @return a {@link ReferenceType} object representing <code>index</code>-th * loaded type by the mirrored virtual machine. */ public ReferenceType getClass(int index) { //PENDING return null; } /** * Returns the event queue for this virtual machine. A virtual machine has * only one {@link net.sourceforge.javaprofiler.jpi.event.EventQueue} object, * this method will return the same instance each time it is invoked. * * @return the {@link net.sourceforge.javaprofiler.jpi.event.EventQueue} * for this virtual machine. */ public EventQueue eventQueue() { //PENDING return null; } /** * Performes the garbage collection in the mirrored virtual machine. */ public void gc() { //PENDING } /** * Returns number of currently running threads in the mirrored virtual machine. * * @return number of currently running threads in the mirrored virtual machine. */ public int getThreadCount() { //PENDING return 0; } /** * Returns all loaded types. For each loaded type in the target VM * a {@link ReferenceType} will be placed in the returned list. The list * will include <code>ReferenceTypes</code> which mirror classes, interfaces, * and array types. * * @return a <code>List</code> of {@link ReferenceType} objects, each * mirroring a loaded type in the target VM. */ public List classes() { //PENDING return null; } } /* * $Log: VirtualMachineImpl.java,v $ * Revision 1.1 2001/11/17 12:02:17 stolis * First version of VirtualMachineImpl. * */ |