Page 3 of 3
The difference represents the elapsed time since the client submitted the array to the server until the server acknowledges it. The difference is then submitted to the standard output.
class ViewServant extends _ViewImplBase {
/*---------------------------------------------------------*/
ViewServant () {
System.out.println("ViewServant() exiting.");
}
/*---------------------------------------------------------*/
public void send_byte (long time_start, int n, byte[] array) {
System.out.println ("send_byte: entered.");
long time_diff, time_0;
time_0 = System.currentTimeMillis();
time_diff = time_0 - time_start;
System.out.println ("Time to xfer " + n + "BYTEs: " + time_diff + "
(ms)");
System.out.println ("send_byte: exiting.");
}
/*---------------------------------------------------------*/
public void send_int (long time_start, int n, int[] array) {
System.out.println ("send_int: entered.");
long time_diff, time_0;
time_0 = System.currentTimeMillis();
time_diff = time_0 - time_start;
System.out.println ("Time to xfer " + n + "INTs: " + time_diff + "
(ms)");
System.out.println ("send_int: exiting.");
}
/*---------------------------------------------------------*/
public void send_double (long time_start, int n, double[] array) {
System.out.println ("send_double: entered.");
long time_diff, time_0;
time_0 = System.currentTimeMillis();
time_diff = time_0 - time_start;
System.out.println ("Time to xfer " + n + "DOUBLEs: " + time_diff + "
(ms)");
System.out.println ("send_double: exiting.");
}
/*---------------------------------------------------------*/
public void send_float (long time_start, int n, float[] array) {
System.out.println ("send_float: entered.");
long time_diff, time_0;
time_0 = System.currentTimeMillis();
time_diff = time_0 - time_start;
System.out.println ("Time to xfer " + n + "FLOATs: " + time_diff + "
(ms)");
System.out.println ("send_float: exiting.");
}
}
The decision to use CORBA should depend on the data transfer speeds between the client and the server running on the desirable platforms. The reader can use the Java IDL implementation or other CORBA implementations and compare results. Hopefully, this Java Tip has given you something to build on when benchmarking application-specific data types and data sizes.