timing remote calls
Hi, I am developing a simple rmi server/client program. I need to return the time taken to perform operations. eg client reads all array locations on server, and needs to return the time taken to perform this task. which class is best? Timer? Date? Time? all the API documentation is too indepth for a simple task like this. Thanks
Any of those classes would be fine, but, for your purposes, a long would probably be easiest. Just run System.currentTimeMillis() before contacting the server. When you receive the response, run currentTimeMillis() again. The difference between the two long variables is the time elapsed. You can use the long values to construct/set Date Objects if you want to format the values into a syntax that may be easier to read, but having the millisecond values should be enough for your purposes, ie
long start = System.currentTimeMillis();
executeRemoteMethods();
long elapsed = System.currentTimeMillis() - start;