Aruna A. Raghavan<br />SCJP, SCJD, SCWCD
If everything is under control, you're going too slow.<br /> Mario Andretti
Remote objects don't need to be Serializable, as they will never be serialized from one JVM to another as part of an RMI call. Only non-remote objects involved in an RMI call do need to be serializable.Originally posted by Jai Karuppuswamy:
The class that implements this RemoteDataInterface can implement java.io.Serializable.
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
Aruna A. Raghavan<br />SCJP, SCJD, SCWCD
Aruna A. Raghavan<br />SCJP, SCJD, SCWCD
Remote objects don't need to be Serializable
If everything is under control, you're going too slow.<br /> Mario Andretti
Aruna A. Raghavan<br />SCJP, SCJD, SCWCD
Yuck. What reason could you possibly have to throw away all exception type information?Originally posted by Aruna Raghavan:
I created a DataInterface that has methods that throw generic Exceptions.
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
Aruna A. Raghavan<br />SCJP, SCJD, SCWCD
Aruna A. Raghavan<br />SCJP, SCJD, SCWCD
What is exactly the advantage of knowing whether I am catching a RemoteException or DatabaseException rather than just an exception? Being able to give the user a more relevant and meaningful error?
Aruna A. Raghavan<br />SCJP, SCJD, SCWCD
In general, different errors are often handled completely differently. Transient transport errors may sometimes be handled by retrying a couple of times, perhaps after a sleep(). System errors are logged and perhaps an administrator is alerted. User errors ("this destination does not exist dumbo") are again handled differently. You don't need such detailed exception handling in the context of this assignment, but that doesn't mean you can let your good practices slip.Originally posted by Aruna Raghavan:
What is exactly the advantage of knowing whether I am catching a RemoteException or DatabaseException rather than just an exception? Being able to give the user a more relevant and meaningful error?
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
Aruna A. Raghavan<br />SCJP, SCJD, SCWCD
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
Aruna A. Raghavan<br />SCJP, SCJD, SCWCD
Aruna A. Raghavan<br />SCJP, SCJD, SCWCD
Aruna A. Raghavan<br />SCJP, SCJD, SCWCD
Aruna A. Raghavan<br />SCJP, SCJD, SCWCD
Indeed. So it isn't because you're implementing an interface throwing RemoteException, but because in your code you are calling something else that itself may throw RemoteException. As you found out, it is perfectly alright for an interface implementation to throw fewer (or narrower) exceptions than the interface specifies.Originally posted by Aruna Raghavan:
Looks like the compile error is happening because my Connection class forwards requests to my Data class. [...] So, when my Connection class forwards requests to the DataInterface Object, I get the error about not handling the Remote exceptions being thrown by the DataInterface object.
And you do have them, only you don't realise it It does not say anywhere that you actually have to write the client-side DataInterface implementation yourself, only that it has to exist and that it will have different constructors. The client-side RMI stub class generated by rmic satisfies all the criteria in the assignment.This essentially takes out the need to have both RemoteData and LocalData. But the assignment requirement says that I should have two Data implementations, one on the client side and one on the server side.
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
Neither implementation throws them. The client-side rmic-generated stub does throw them because of the RMI plumbing that sits behind it. The RemoteExceptions are handled by your client code (i.e. the GUI will pop up a error box or something similar).Originally posted by Sam O'Neill:
[...] I am missing the part where we then handle RemoteExceptions.
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
And you do have them, only you don't realise it It does not say anywhere that you actually have to write the client-side DataInterface implementation yourself, only that it has to exist and that it will have different constructors. The client-side RMI stub class generated by rmic satisfies all the criteria in the assignment.
Christian
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
..it doesn't say anywhere that you have to write this class yourself.
Christian
The only point I'm trying to make is that many are reading the instructions as You have to write a class that implements the same public methods as the suncertify.db.Data class [...].Originally posted by Christian Garcia:
I'm a confused on this statement, though: "It doesn't say anywhere that you have to write this class yourself."
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
Christian
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
Christian
Catch Ernie! Catch the egg! And catch this tiny ad too:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|