COIT13229, 2018 Term One - Page 1 of 9 Applied Distributed Systems COIT 13229 Assessment item 2—Java TCP Client Server Application Due date: XXXXXXXXXXWeek 10 T1-18 – 11.45PM AEST, Friday 18th May...

i have pasted the specification and other two files are for reference. just make sure i get the correct result as specification and word file done nicely. In part c, you need to compare this assignment (TCP connection) with the first assignment (UDP connection) so if you need that i will give that also. just let me know via email or phone


COIT13229, 2018 Term One - Page 1 of 9 Applied Distributed Systems COIT 13229 Assessment item 2—Java TCP Client Server Application Due date: Week 10 T1-18 – 11.45PM AEST, Friday 18th May 2018 ASSESSMENT Weighting: 30% Length: N/A 2 Objectives This assessment item is designed to test your understanding in Java TCP networking, multi- threading concept, Object Serialization and client/server application development. Assessment task Write a java application using lightweight Java RMI Framework and demonstrate its application. Your task for this assignment is to design and implement RMI using Java TCP API Socket. Using TCP protocol and client/server model, you can implement a remote method invocation framework. In this assignment, you are to implement such a remote method 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 generic remote servers 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 for registering or looking up the remote objects. In this assignment (assignment-2), you are to implement a remote invocation framework that is similar to Java RMI but lightweight and no registry is required (note: for this assignment, you don’t use any Java RMI APIs). To implement the framework, you will need to use Java Interface, Java Objection Serialization, Java Thread and client/server model. COIT13229, 2018 Term One - Page 2 of 9 Part 1: Java TCP Networking, Multi-threading and Object Serialization Programming The framework consists of the classes given in the below. Constants SERVERNAME=”localhost” and SERVERPORT=9999; 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(ComputeCircle,ComputeSquare,ComputeRectangle) must implement this Task interface. Executing the overridden method executeTask() will perform the specific task and set the result. Calling the getResult() method will return the result. COIT13229, 2018 Term One - Page 3 of 9 2. The ComputeClient and ComputeServer The ComputeServer is used as a generic compute-engine. While running, the server is continuously waiting to receive and compute-tasks. A compute-task is created by a ComputeClient and sent as a serialized object to the ComputeServer. Once the ComputeServer receives a task, it will cast (deserialize) it into the Task interface type and call its executeTask() method. After executing the task, the ComputeServer will send the same object back to the ComputeClient. 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 ComputeClient and the ComputeServer. Starting Server: Starting Client: COIT13229, 2018 Term One - Page 4 of 9 Normal Interaction COIT13229, 2018 Term One - Page 5 of 9 3. Handling ClassNotFoundException on ComputeServer and ComputeClient If all the java files are in the same folder and deployed you do not need this approach because Compute Server has access to all the .class files. In reality ComputeClient and ComputeServer may be deployed from different locations locally or remotely and in that case, the ComputeServer should have access to all the class definitions (.class files), this framework makes the ComputeServer generic. That is, the ComputeServer just needs to know the Task interface, then it can be compiled and run. If a ComputeClient implements a new compute-task while the server is running, the ComputeClient needs to upload the Java class of the compute-task into a pre-determined network location, and link it during ComputeServer compilation, for simplicity we copy them to a folder where ComputeServer resides. If the class file is removed before the compute-server starts, it will throw ClassNotFoundException which should be handled well without causing a system crash. The following screenshot shows the folder contents when ComputeCircle.class is removed before ComputeServer is started. However, when there is an exception occurred (e.g. a ComputeClient wants the ComputeServer to perform a compute-task, but forgets uploading the Java class of the compute-task.), the ComputeServer will create an ErrorMessage object and sends it back to the ComputeClient. Note: the ErrorMessage follows the interaction contract by implementing the Task interface. By calling the getResult() method. import java.io.*; public class ErrorMessage implements Task,Serializable { //The variable that holds the error information private String finalResult; public ErrorMessage(){ } COIT13229, 2018 Term One - Page 6 of 9 //Return the final computing result public Object getResult() { return finalResult; } //Set the error message public void setErrorMessage(String msg){ finalResult=msg; } public void executeTask(){ } } Before the compute-task ComputeCircle is uploaded: COIT13229, 2018 Term One - Page 7 of 9 After the compute-task ComputeCircle is uploaded: COIT13229, 2018 Term One - Page 8 of 9 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. This information is also online at, http://docs.oracle.com/javase/7/docs/api/java/net/Socket.html, and http://docs.oracle.com/javase/7/docs/api/java/net/ServerSocket.html). Please note: use of any other protocols will incur no marks to be awarded for this part. 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. Submission You need to provide the following files in your submission. 1. All java files mentioned in class diagram, the ComputeServer should have inner class to support thread processing. The in-line comments on the data structures and control statements used in the programs are required. These source code files must be able to be compiled by the standard JDK (Java Development Kit). (http://www.oracle.com/technetwork/java/index.html). 2. The compiled Java class files of the source code. These Java classes must be runnable on the standard Java Runtime Environment (JRE) and be placed in the same location as that of the server. (http://www.oracle.com/technetwork/java/index.html). COIT13229, 2018 Term One - Page 9 of 9 3. A Microsoft Word document to address the issues as specified in the Part 2 above. Part 3: Compare and contrast Assignment1 (UDP) with Assignment2 (TCP) In this section you need to discuss the differences between the technologies used in assignment1 and assignment2. Which technology is best suitable for what applications? And also the overheads involved for both the technologies. Limit your discussion to within 300 words. Any hardcopy or email submission will not be accepted. After the marked assignments are returned, any late submissions will not be accepted. The Marking Criteria
May 05, 2020COIT13229Central Queensland University
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here