Simulate compute-client and compute-server interaction

Assignment Help Database Management System
Reference no: EM131146583 , Length: word count:1500

The Assignment-1

Java Interface, Java Object Serialization, Java multi-threading model and client/server model are very useful and important Java components to build distributed applications. In this assignment, you are to research the Java APIs on Java Interface, Object Serialization, multi-threading model and client/server model and write a technical report. The report is to be structured as an academic report and must be appropriately referenced using the Author-Date style. The length of the report should be about 2,500 words. You are not required to provide an executive summary for the report, but your report must be organised into the format of an introduction section, a body (multiple sections) and a conclusion section. An Exemplar for Writing a Simple Academic Technical Report is available on the course web site. You should read this exemplar before writing your report.

Note: thorough review and understanding of these Java APIs or models are also important for the assignment-2, where you need to use these APIs and models to implement a distributed application.

To prepare your report, you will need to research widely on these Java APIs and models. Your report must cover the issues that are detailed as follows.

Introduction

Give your introduction to these Java APIs and models. Present the organisation of your report.

Review of Java Interface

Use an example to describe
1. What is Java Interface?
2. What is the use of a Java interface?
3. What is the implementation of a Java interface?

Review of Java Object Serialization

Use an example to describe
1. What is Java Object Serialization?
2. What is the use of object serialization?
3. How to make a Java object serializable?

Review of Java multi-threading model

Use an example to describe
1. What is multi-threading?
2. The difference between a process and a thread
3. The two ways to create a Java thread
4. How to start running a Java thread

Note: to show your understanding you should compose your own examples. You are not to use the examples from this course textbook or the course online materials.

Review of client/server model

1. What is client/server model?
2. Why must the server be multi-threaded?

Conclusion

Conclude why these APIs and models are the components to build distributed applications.

The Assignment-2 Specification and Marking Criteria

Java RMI (Remote Method Invocation) makes 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, 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). To implement the framework, you will need to use Java Interface, Java Objection Serialization, Java Thread and client/server model. Recall you have written a technical report about these Java components and models for assignment-1; now you will need to use these Java components to build this framework. Thus if necessary, you may need to review your assignment-1.

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 codebase 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 in advance before the framework can start to run. The specification of the components is as follows.

1825_fig.png

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.

2. The compute-client and compute-server

The compute-server is used as a generic compute-engine. While running, the server is continuously waiting for the 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) it 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.

3. The codebase 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 world application it could be a FTP server, 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 codebase 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.

4. 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 codebase of 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) { finalResult=msg;
}
public void executeTask() {
}

}

To complement 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 course 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 course and also online at,

https://docs.oracle.com/javase/7/docs/api/java/net/Socket.html, and

https://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.

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

1. A Java application to implement the compute-client;

2. A Java application to implement the compute-server; and

3. A Java class to implement the request processing thread.

4. 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.

Attachment:- Distributed Systems.rar

Reference no: EM131146583

Questions Cloud

Determine the coefficient of friction between the block : If the frequency of motion of the block is found to be determine the coefficient of friction between the block and the rollers.
What is the explanation for the difference in the two rates : The return on assets for Corwin Corporation is 7.6%. During the same year, Corwin’s return on common stockholders’ equity is 12.8%. What is the explanation for the difference in the two rates?
Discuss any sort of personal benchmarking : Discuss any sort of personal benchmarking you might conduct in order to boost your performance as a student, an athlete, or a hobbyist. Provide an example to support your discussion.
Analyze key accounting requirements for each of two choices : Select two out of the three choices provided in the above scenario, and analyze the key accounting requirements for each of the two choices that you selected.
Simulate compute-client and compute-server interaction : 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
What is the net income for this firm : Building an Income statement. Lifetime, Inc. has sales of $585,000, costs of $273, 000, depreciation expense of $71,000, interest expense of $38,000, and a tax rate of 35%. What is the net income for this firm?
Internal processes helps build highly efficient organization : Internal processes of a company contribute to the company's overall effectiveness. Identifying ways to improve internal processes helps build a highly efficient organization. Root causes need to be identified. Methods to identify root causes may requ..
Identify a current business news of your choice : Identify a current business news of your choice and explain the effects that any TWO forces out of Porter's Five Forces have had on the incident reported in the news
List all file names that you can identify in the trace file : Determine what was being done via the HTTP protocol. Was the user sending an email, browsing a website, uploading a file, etc.? Write a brief summary explaining what the user was doing using the HTTP protocol. List all file names that you can ident..

Reviews

Write a Review

Database Management System Questions & Answers

  Provide an unique example of a supertypesubtype

provide an unique example of a supertypesubtype relationship. be sure to describe the relationship and discuss if the

  Database modeling and design

Database Modeling and Design: A complete table diagram. Transform model to tables, include all attributes and keys.

  Which management used to evaluate oracle database offerings

What were the important business factors which management used to evaluate Oracle's database offerings

  Create a database schema that supports the companys business

Create a database schema that supports the company's business and processes. Explain and support the database schema with relevant arguments that support the rationale for the structure.

  How much overhead cost would be assigned to product

How much overhead cost would be assigned to Product S96U using the company's activity-based costing system?

  Difference between manufacturing and service industries

Discuss whether the ERP software is mostly suitable for manufacturing companies or whether it can be used in service industries also.

  Compare the number of admissions in st mary

Using the Minnesota hospitals admission by care unit database for the year 2012, our topic is to compare the number of admissions in St. Mary's and the University of Minnesota hospital center. We chose these two organizations because of their impo..

  Analyse the behaviour of the most important stateful object

Analyse the behaviour of the most important stateful object of the system and document this behaviour with.

  Create a database design - relational data model

Create a database design specification Enhanced Entity Relationship Diagram (EERD) and Relational Data Model from the given business description - Database Management System

  Discussion about database applications

Discussion about Database Applications.

  Computing functional dependencies

Compute the functional dependencies which exist in following table. After determining the functional dependencies, transform this table to an equivalent collection of the tables which are in third normal form.

  Prepare a report - the report should be related to business

prepare a report - the report should be related to business communications.topics to cover in your written reportbull

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd