A Simplified Remote Invocation Framework: Assignment help

    Need Solution - Download from here

    The Assignment 1 Specification and Marking Criteria

    A Simplified Remote Invocation Framework

    Java RMI (Remote Method Invocation, reference Chapter 5 of the textbook and Week-3 lecture) enables the local invocation and remote invocation use the same syntax to implement a generic remote server like the Compute Engine example in Week-3 lecture slides. However, Java RMI needs 2 HTTP servers to transfer Java classes between a RMI client and a RMI server at runtime. In addition, Java RMI applications need a RMI Registry to register or look up the remote objects. In this assignment, you are to implement a remote invocation framework that is similar to Java RMI but lightweight (note: for this assignment, you don’t use any Java RMI APIs).

    Java object serialization, multi-threading model and client/server model are the fundamental Java components to build distributed applications. In this assignment, you are to use these components or models to develop a particular application – a simplified remote invocation framework. The Java object serialization, multithreading and client/server components have been introduced through weekly lectures, tutorials and lab projects of this unit; you should ensure that you have good understanding of these learning materials before you start this assignment. In this assignment, you will need to integrate what you have learnt to develop the framework. This assignment specification is as follows.

    Part 1: Java TCP Networking, Multi-threading and Object Serialization Programming

    The framework consists of a compute-server, a compute-client and a class repository, which are depicted in the following diagram. The framework is a generic computing architecture because the compute-client and compute-server just need to know the Task and CSMessage interface or class in advance to interact with each other via the framework. The specification of the components is as follows.

    Screen Shot 1941-04-24 at 2.53.18 PM

    1. The interaction contract

    The interaction contract between the client and server is defined by the Task interface:

    //The Task interface (interaction contract) between clients and the server public interface Task {
    public void executeTask();
    public Object getResult();

    Every compute-task must implement the Task interface. Executing the executeTask() method will perform the task and set the result. Calling the getResult() method will return the result.

    1. The compute-client and compute-server

    The compute-server is used as a generic compute-engine. When running, the server is continuously waiting for compute-tasks. A compute-task is created by a compute-client and sent as a serialized object to the compute server. Once the compute-server receives a task, it will cast (be deserialized) the task into the Task interface type and call its executeTask() method. After executing the task, the compute-server will send the same object back to the compute-client.

    The compute-client is continuously accepting a user’s requests. Every request specifies a compute-problem and its corresponding parameters. For a request, the compute-client creates a compute-task and sends it as a serialized object to the compute-server. Once receiving the compute-task object back from the server, the compute-client will call the getResult() method of the object to display the result.

    The following screenshots show the interaction between a compute-client and the compute-server.

    Screen Shot 1941-04-24 at 2.54.59 PM

    Screen Shot 1941-04-24 at 2.56.05 PM

    Screen Shot 1941-04-24 at 2.57.00 PM

    1. The class repository

    Such a framework makes the compute-server generic. That is, the compute-server just needs to know the Task interface, then it can be compiled and run. If a compute-client implements a new compute-task after the server is run up, the compute-client just needs in some way (in real 4

    world application it could be a FTP upload, but in this assignment, you just need to copy the files into a directory) to upload the Java class of the compute-task into a pre-determined network location (e.g. the Contract directory), which the compute-server can access from its Java classpath. Then the compute-server can perform such a new compute-task. Therefore, the server never needs to be shut down, recompiled, and restarted for any new tasks.

    The following screenshot shows that there are 2 compute-tasks that have been uploaded into the Contract repository.

    Screen Shot 1941-04-24 at 3.22.27 PM

    1. The error message

    However, when there is an exception occurred (e.g. a compute-client wants the compute-server to perform a compute-task, but forgets uploading the Java class of the compute-task) onto the class repository of the compute-server, the compute-server will create a CSMessage object and sends it back to the compute-client. Note: the CSMessage follows the interaction contract by implementing the Task interface. By calling the getResult() method, the compute-client will know the problem and fix it later on.

    import java.io.*;
    public class CSMessage implements Task, Serializable { //The variable that holds the error information private String finalResult;
    public CSMessage() {
             //Return the final computing result
             public Object getResult() {
             return finalResult;
             //Set the error message
             public void setMessage(String msg) {
             public void executeTask() {

    The following screenshots show the situation of calling the compute-server before and after the compute-task ComputeGCD is uploaded.

    • Before the compute-task ComputeGCD is uploaded:

     Screen Shot 1941-04-24 at 3.23.23 PM

    Screen Shot 1941-04-24 at 3.23.34 PM

    • After the compute-task ComputeGCD is uploaded:

    Screen Shot 1941-04-24 at 3.24.32 PM

    Screen Shot 1941-04-24 at 3.24.53 PM

    Screen Shot 1941-04-24 at 3.25.03 PM

    To complete this assignment, you need to implement such a framework and integrate the Calculate Pi, Calculate Primes and Calculate the Greatest Common Divisor tasks into this framework. The algorithms of these tasks are given on the unit web site. Your compute-server must be multi-threaded and follow the ‘thread-per-connection’ architecture (reference Week-4 contents). The communication between the compute-server and the compute-client must use TCP protocol through the Java TCP API Socket and ServerSocket as described in Week-2 contents of this unit and also online at, https://docs.oracle.com/javase/8/docs/api/java/net/Socket.html, and https://docs.oracle.com/javase/8/docs/api/java/net/ServerSocket.html). Please note: use of any other protocols will incur no marks to be awarded for this part.

    To implement the framework, you need to implement the following Java classes:

    1. A Java application to implement the compute-client; graphic user interface is required;
    1. A Java application to implement the compute-server; and
    1. A Java class to implement the request processing thread.
    1. A number of Java classes to implement Calculate Pi, Calculate Primes and Calculate the Greatest Common Divisor tasks.

    Note: to simulate compute-client and compute-server interaction, you don’t have to run them on two physical machines. Instead, they can be run on two JVMs (Java Virtual Machines) on a single physical machine. As a result, the name of the server machine can be ‘localhost’.

    Part 2: Program use and test instruction

    After the implementation of the framework, prepare an end user’ instruction about how to use your software. The instruction should cover all aspects of the framework as detailed in the marking criteria below.



    You can order the Simplified Remote Invocation Framework assignment from our service and receive a completely high-quality custom paper. Our service offers any of the Simplified Remote Invocation Framework academic paper written from scratch, according to all customers’ specifications, expectations and highest standards.”

    Leave A Comment