我需要实现一个RMI服务器,它将作为另外两个RMI服务的前端。因此,我决定实现这个接口时,也要实现另外两个服务的接口。
public interface FrontEndServer extends Remote, BookServer, StudentServer
{
// Block empty so far
}
然而,在StudentServer上有一种方法。
/**
* Allows a student to borrow a book
*
* @param studentID of the student who wishes to borrow a book
* @param bookID of the book the student wishes to borrow
* @throws RemoteException
* @throws StudentNotFoundException when a student is not found in the system
*/
void addBookToStudent(int studentID, int bookID) throws RemoteException, StudentNotFoundException;
我希望
FrontEndServer
还能抛出BookNotFoundException
,因为该服务在尝试添加细节之前也会验证书籍是否真实存在。这个设计想法是可行的吗?如果其他接口发生变化怎么办?我最好写下FrontEndServer
中所有方法的签名吗?