分布式计算实验.docx华南理工大学
《分布式计算技术》课程实验报告
实验题目:Java RMI实验
姓名: 学号:
班级:电子商务 组别:
合作者:
指导教师:
实验概述
【实验目的及要求】
在Java语言环境下,通过RMI实现一个学生成绩或教SQLException e) (
System, out. print In (zzSQLException: 〃+e・ getMessage ()) ;)
return (RES);
}//end searchGrade
public synchronized void
registerForCal Iback ( / / ************************* 实现
registerForCallback 方法
RMIClientInterface callbackClientObject)
throws java. rmi. RemoteException(
// store the callback object into the vector
if (! (clientList. contains(callbackClientObject))) {
clientList. addElement(callbackClientObject);
System, out. printin (^Registered new client 〃);
doCallbacks ();
} // end if
}
public synchronized void unregisterForCallback(
RMIClientInterface callbackClientObject)
throws java. rmi. RemoteException(
if (clientList. removeElement(callbackClientObject)) {
System, out. printin(^Unregistered client 〃);
} else (
System, out. printin (
"unregister: clientwasn,t registered. 〃);
}
private synchronized void doCallbacks( ) throws java. rmi. RemoteException{ //回调代码
// make callback to each registered client System, out. printin (
//callbacks 初始化
+ "Callbacks initiated 〃);
for (int i = 0; i < clientList. size() ; i++) {
System, out. println(z,doing 〃+ i + 〃一th callback\n〃);
// convert the vector object to a callback object
RMIClientInterface nextClient = (RMIClientlnterface)clientList. elementAt(i);
// inv
分布式计算实验 来自淘豆网m.daumloan.com转载请标明出处.