Assignment 2: Concurrency in Java – Lab (2%)
This assignment relates to the following Course Learning Requirements:
- CLR 1: Implement an objected-oriented program design incorporating the use of best practice design patterns using the JAVA programming language.
- CLR 2: Understand multithreading concepts related to thread-safe Java Servlet programming.
Objective of this Assignment:
Demonstrate the skills required to:
- Apply thread-safe programming concepts within the context of Java programming.
Instructions
To prepare you for this assignment, read the module 3 content and follow the embedded learning activities.
Read the following scenario:
As a continuation of the previous assignment, review the following scenario.
Code&Code is a small company dedicated to Software Development. Their engineering team to which you belong, is working on writing a Web Application as an MVP for a new customer.
The code name for this App is Loggy, which is meant to offer functionality for a personal journal where users can log their daily activities through text, voice and video.
You have moved forward a few weeks ahead and have finished the core functionality. The challenge you have in front of you now, is to perform additional actions to attachments such as, automatic translation, transcoding, automatic closed captioning. These actions are triggered once the media file is uploaded.
As an initial step, you must create the skeleton of the back-end service for performing the automatic closed captioning under these assumptions:
- The closed captioning is performed through an external service (AWS or GCloud).
- There should be an internal controller that:
- Receives the recordings to be processed from a requester
- Sends the recordings to the external service
- Receives its response
- Updates the recoding with the resulting closed captioning; and
- Responds back to the requester
- The recordings can be processed simultaneously, but there is a limit of only 5 concurrent processes that can be handled by the sender.
- Therefore, there should be a queue that will act as a buffer for the overhead.
- Once the recording is processed, the external service responds with a callback, therefore a listener should be ready to receive that request and update the object with a text file containing the strings for the closed captioning.
- Only audio and video can be processed.
- The processing time depends of the length of the recording.
Task
Main class
- Write a Main class that you will use as the simulator for testing you Classes
Closed-captioning controller
- Write the class that will simulate the recording to be processed, which contains an id, the media, a length and the strings for closed captioning.
- Write a class that will be the actual controller (or spooler).
- Write a class that will act as the worker for processing closed captioning though an external service
- Implement the queue and callback actions
Submission
Your submission should include:
- Java code of your final solution.
- Report of your observations on the changes you had to do to your code while following the recommended steps. Add snippets of code to the report to show intermediate steps.
Remember that although the scenario is shared across assignments and the resulting code may be used for future activities, the main goal of this activity is to practice what you have learned in this module.
Do not be worried about finding the perfect solution to this problem. And keep in mind that System.out.println() will be enough for the purposes of illustrating the actions performed by each method.
Guidelines
- Once you have completed all steps and followed submission requirements, post your assignment in the designated attachment section in Brightspace when your facilitator assigns it. Check the course modules and weekly schedule for instructions.
- The submission consists of two separated files.
- A ZIP file (not RAR or any other compressing format) containing your complete java project (including src and static resources); and
b. A DOC file containing your report. - Both files should be named as
loggy-lab2-STUDENTNUMBER.extension
(Where extension means docx, mp4, zip etc, not the word extension)
- Ensure you properly cite any work that is not yours in your submitted documents, including code.