When working with RMI (Remote Method Invocation), it is required for all methods defined in interfaces extending Remote
to contain RemoteException
in their throws
clause.
For example, see the following Computing
interface from this RMI tutorial.
public interface Compute extends Remote {
<T> T executeTask(Task<T> t) throws RemoteException;
}
The problem is that the compiler does not check if the methods are defined correctly, instead an exception is thrown during the execution when the program encounters a method in a Remote
interface that does not throw RemoteException
.
It would be much better if such problems were discovered before the program is actually run. How can one write a test for that condition?
Aucun commentaire:
Enregistrer un commentaire