|
From: Michal P. <mic...@us...> - 2002-09-12 13:52:47
|
Update of /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl In directory usw-pr-cvs1:/tmp/cvs-serv5942/net/sourceforge/javaprofiler/jpiimpl Modified Files: VirtualMachineImpl.java Log Message: Disconnection listener support. Index: VirtualMachineImpl.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/VirtualMachineImpl.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** VirtualMachineImpl.java 11 Sep 2002 19:07:00 -0000 1.16 --- VirtualMachineImpl.java 12 Sep 2002 13:52:43 -0000 1.17 *************** *** 2,7 **** * 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/ * --- 2,7 ---- * 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/ * *************** *** 38,44 **** private boolean isSuspendedVM; private Process process=null; ! private VirtualMachineImageRef realtime=null; ! /** * Creates new VirtualMachineImpl. --- 38,45 ---- private boolean isSuspendedVM; private Process process=null; ! private VirtualMachineImageRef realtime=null; ! private List dl = new LinkedList(); ! /** * Creates new VirtualMachineImpl. *************** *** 55,59 **** * @param iprof corresponding <code>IProf</code> object. * @param process corresponding <code>Process</code> object. ! */ public VirtualMachineImpl(IProf iprof, Process process) { this.iprof=iprof; --- 56,60 ---- * @param iprof corresponding <code>IProf</code> object. * @param process corresponding <code>Process</code> object. ! */ public VirtualMachineImpl(IProf iprof, Process process) { this.iprof=iprof; *************** *** 63,67 **** rt.getTimer().schedule(rt.getTimerTask(), 1000, 1000); } - /** * Enables/disables the garbage collection in the mirrored virtual machine. --- 64,67 ---- *************** *** 78,83 **** iprof.disableGC(); } ! } catch (COMMUN_Exception e) { ! throw new VMDisconnectedException(); } catch (UNAVAILABLE_Exception e) { //PENDING --- 78,83 ---- iprof.disableGC(); } ! } catch (COMMUN_Exception e) { ! fireVMDisconnected(); } catch (UNAVAILABLE_Exception e) { //PENDING *************** *** 146,154 **** iprof.exitVM(); } catch (COMMUN_Exception e) { ! throw new VMDisconnectedException(); } } ! /** * Returns size (in bytes) of allocated memory in the mirrored virtual * machine. --- 146,154 ---- iprof.exitVM(); } catch (COMMUN_Exception e) { ! fireVMDisconnected(); } } ! /* * Returns size (in bytes) of allocated memory in the mirrored virtual * machine. *************** *** 157,164 **** * machine. */ ! public long totalMemory() { //PENDING return 0; ! } /** --- 157,164 ---- * machine. */ ! /*public long totalMemory() { //PENDING return 0; ! }*/ /** *************** *** 170,174 **** iprof.suspendVM(); } catch (COMMUN_Exception e) { ! throw new VMDisconnectedException(); } catch (UNAVAILABLE_Exception e) { //PENDING --- 170,174 ---- iprof.suspendVM(); } catch (COMMUN_Exception e) { ! fireVMDisconnected(); } catch (UNAVAILABLE_Exception e) { //PENDING *************** *** 191,195 **** iprof.stop(); } ! /** * Resumes all threads in the virtual machine. --- 191,211 ---- iprof.stop(); } ! ! public void addDisconnectionListener( DisconnectionListener l) { ! dl.add( l); ! } ! ! public void removeDisconnectionListener( DisconnectionListener l) { ! dl.remove( l); ! } ! ! void fireVMDisconnected() { ! List dls = new LinkedList( dl); ! Iterator i = dls.iterator(); ! while ( i.hasNext()) { ! (( DisconnectionListener)i.next()).VMDisconnected(); ! } ! } ! /** * Resumes all threads in the virtual machine. *************** *** 200,204 **** iprof.resumeVM(); } catch (COMMUN_Exception e) { ! throw new VMDisconnectedException(); } catch (UNAVAILABLE_Exception e) { //PENDING --- 216,220 ---- iprof.resumeVM(); } catch (COMMUN_Exception e) { ! fireVMDisconnected(); } catch (UNAVAILABLE_Exception e) { //PENDING *************** *** 207,219 **** } ! /** * 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; ! } /** --- 223,235 ---- } ! /* * 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; ! }*/ /** *************** *** 224,228 **** iprof.runGC(); } catch (COMMUN_Exception e) { ! throw new VMDisconnectedException(); } catch (UNAVAILABLE_Exception e) { //PENDING --- 240,244 ---- iprof.runGC(); } catch (COMMUN_Exception e) { ! fireVMDisconnected(); } catch (UNAVAILABLE_Exception e) { //PENDING *************** *** 248,253 **** iprof.shutdown(); } catch (COMMUN_Exception e) { ! throw new VMDisconnectedException(); ! } } --- 264,269 ---- iprof.shutdown(); } catch (COMMUN_Exception e) { ! fireVMDisconnected(); ! } } *************** *** 268,275 **** return iprof.isShutdowned(); } catch (COMMUN_Exception e) { ! throw new VMDisconnectedException(); } } ! /**Returns realtime image of library. After that you can access information in library realtime * without creating snapshot. For one instace of VirtalMachineImpl it returns always the same refenrece. --- 284,292 ---- return iprof.isShutdowned(); } catch (COMMUN_Exception e) { ! fireVMDisconnected(); ! return true; } } ! /**Returns realtime image of library. After that you can access information in library realtime * without creating snapshot. For one instace of VirtalMachineImpl it returns always the same refenrece. *************** *** 289,307 **** } } - - /** Register a disconnection listener */ - public void addDisconnectionListener(DisconnectionListener l) { - //PENDING - } - - /** Unregister a disconnection listener */ - public void removeDisconnectionListener(DisconnectionListener l) { - //PENDING - } - } /* * $Log$ * Revision 1.16 2002/09/11 19:07:00 vachis * really horribele pacth --- 306,317 ---- } } } /* * $Log$ + * Revision 1.17 2002/09/12 13:52:43 michalpise + * + * Disconnection listener support. + * * Revision 1.16 2002/09/11 19:07:00 vachis * really horribele pacth *************** *** 355,357 **** * First version of VirtualMachineImpl. * ! */ \ No newline at end of file --- 365,367 ---- * First version of VirtualMachineImpl. * ! */ |