![]() ![]() ![]() Set2.MonthlyPayment = calc.PITI(set2.Balance, set2.InterestRate, Set1.MonthlyPayment = calc.PITI(set1.Balance, set1.InterestRate, Public calcPITI(int HousePrice, double InterestRate, Set6.MonthlyPayment = calc.PI(set6.Balance, set6.InterestRate, set6.Years) Set5.MonthlyPayment = calc.PI(set5.Balance, set5.InterestRate, set5.Years) Set4.MonthlyPayment = calc.PI(set4.Balance, set4.InterestRate, set4.Years) Set3.MonthlyPayment = calc.PI(set3.Balance, set3.InterestRate, set3.Years) Set2.MonthlyPayment = calc.PI(set2.Balance, set2.InterestRate, set2.Years) Set1.MonthlyPayment = calc.PI(set1.Balance, set1.InterestRate, set1.Years) Public CalculateImpl(String name) throws RemoteException Public class CalculateImpl extends UnicastRemoteObject We'll begin with the source for the CalculateImpl implementation class: ![]() #Relax now ver 1.2 registration#(This process is similar in concept to the registration of a CORBA object with the basic object adaptor, BOA, within the ORB.) The Naming class is defined within and is used to register the object with the Java RMI registry. The only portion that may look unfamiliar is the call to Naming.rebind() within the CalculateImpl constructor. #Relax now ver 1.2 code#The majority of the code involved in this step is pretty straightforward. This will make the class available on the server to any client applications that desire to make use of it. The first requires us to implement the Calculate interface, while the second requires us to build a server application that instantiates the implementation class. Step number two actually consists of two smaller steps. Private void readObject(ObjectInputStream s) throws IOException Private void writeObject(ObjectOutputStream s) throws IOException Public class ResultSet implements Serializable RMI requires that all items passed between local and remote objects implement the Serializable interface. Also notice that the ResultSet class implements the java.io.Serializable interface. Keep in mind that a single call to one of Calculate's methods will return numerous ResultSet objects stored in a Vector. At this time, we'll also define a class, ResultSet, to contain the data calculated by the interface's methods. The methods in this interface return a Vector object, which acts as a container for other objects. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |