Update of /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/commun
In directory usw-pr-cvs1:/tmp/cvs-serv19732/net/sourceforge/javaprofiler/jpiimpl/commun
Modified Files:
IProf.java
Added Files:
INTERFACE_VERSION_MISMATCH_Exception.java
Log Message:
fixes
--- NEW FILE: INTERFACE_VERSION_MISMATCH_Exception.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.commun;
/** Interface version mismatch exception. This exception is raised when
** versions of communication interface on server and client sides differ.
**
** @author Marek Przeczek */
public class INTERFACE_VERSION_MISMATCH_Exception extends IProfException {};
Index: IProf.java
===================================================================
RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/commun/IProf.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** IProf.java 4 Apr 2002 00:48:01 -0000 1.17
--- IProf.java 15 Apr 2002 21:01:05 -0000 1.18
***************
*** 38,41 ****
--- 38,44 ----
import java.lang.*;
+ /* PLEASE DO NOT FORGET TO INCREASE 'INTERFACE_VERSION_NUMBER'
+ * CONSTANT OF THIS CLASS WHEN YOU DO SOME ANY CHANGES IN THE INTERFACE. */
+
/** Communication interface class. This class implements
** the whole communication interface between Java client
***************
*** 51,54 ****
--- 54,60 ----
public class IProf {
+ /// version number of communication interface
+ private static final int INTERFACE_VERSION_NUMBER = 1;
+
/** Default constructor. Sockets are used
** for communication between his Java client and
***************
*** 85,98 ****
/** Start client/server communication. This method starts the
** client (or server, if specified). To stop the communication,
! ** stop() method must be called.
**
! ** @see stop()
! **
! ** @return false (failure occurred);
! ** true (ok, communication started) */
! public boolean run() {
! return !( _commun.hasFailed() || !_commun.initialize());
}
--- 91,123 ----
/** Start client/server communication. This method starts the
** client (or server, if specified). To stop the communication,
! ** stop() method must be called. If failed, stop() method must
! ** be called, too !!! It can fail either because of communication
! ** problem or because of interface version mismatch.
**
! ** @see stop() */
! public void run()
!
! throws COMMUN_Exception,
! INTERFACE_VERSION_MISMATCH_Exception {
! if( _commun.hasFailed() || !_commun.initialize())
!
! throw new COMMUN_Exception();
!
! _buf.clear();
! _buf.putInt( INTERFACE_VERSION_NUMBER);
!
! _commun.write( _buf);
! if( _commun.hasFailed()) throw new COMMUN_Exception();
!
! _commun.read( _buf);
! if( _commun.hasFailed()) throw new COMMUN_Exception();
!
! int version = _buf.getInt( 0);
!
! if( version != INTERFACE_VERSION_NUMBER)
!
! throw new INTERFACE_VERSION_MISMATCH_Exception();
}
|