Answered step by step
Verified Expert Solution
Question
1 Approved Answer
java 5. Using Java Remote Method Invocation, write the Java code for a remote compute server that could be used to remotely execute arbitrary Task
java
5. Using Java Remote Method Invocation, write the Java code for a remote compute server that could be used to remotely execute arbitrary Task objects. The server allows clients to submit Task objects, that is objects that implement the Task interface, for remote execution on the server and are then returned the result as a Java object. The following Java interfaces / classes should be provided Compute - this remote interface should provide a method to upload Task objects to the server and to then run the task and return the result back to the client when execution is complete 4 MARKS Task - this interface should define an arbitrary task object that may be passed as a parameter to the compute server. 4 MARKS MathTask - this class provides an implementation of the Task interface and is used to perform some calculation that returns an Integer object. The calculation itself can be just some simple arithmetic e.g. add two numbers 6 MARKS ComputeServer - this class should provide an implementation of the Compute interface as well as the code required to initialise the server and make the remote object locatable for clients in the RMI registry. The server runtime should be protected so that objects uploaded to the server can not cause any harm 6 MARKS ComputeClient -this should provide a simple client program that creates a MathTask object and submits it to the server for remote execution and then displavs the result 5 MARKS The design of the system should make it possible for new Task classes to be easily added to the system in the future, making the system very flexible. The design should use Java RMI and Object Serialisation to submit Task objects and to return the result back to the client 5. Using Java Remote Method Invocation, write the Java code for a remote compute server that could be used to remotely execute arbitrary Task objects. The server allows clients to submit Task objects, that is objects that implement the Task interface, for remote execution on the server and are then returned the result as a Java object. The following Java interfaces / classes should be provided Compute - this remote interface should provide a method to upload Task objects to the server and to then run the task and return the result back to the client when execution is complete 4 MARKS Task - this interface should define an arbitrary task object that may be passed as a parameter to the compute server. 4 MARKS MathTask - this class provides an implementation of the Task interface and is used to perform some calculation that returns an Integer object. The calculation itself can be just some simple arithmetic e.g. add two numbers 6 MARKS ComputeServer - this class should provide an implementation of the Compute interface as well as the code required to initialise the server and make the remote object locatable for clients in the RMI registry. The server runtime should be protected so that objects uploaded to the server can not cause any harm 6 MARKS ComputeClient -this should provide a simple client program that creates a MathTask object and submits it to the server for remote execution and then displavs the result 5 MARKS The design of the system should make it possible for new Task classes to be easily added to the system in the future, making the system very flexible. The design should use Java RMI and Object Serialisation to submit Task objects and to return the result back to the clientStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started