Professional Documents
Culture Documents
java
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
if(numberOfThreads==3)
{
NotificationManager l=NotificationManager.getInstance();
//System.out.println(notification.get(1));
for (int i=0;i<notification.size()-1;i++)
// for (String b:notification)
{
String val[]=notification.get(i).split(",");
int code=Integer.parseInt(val[1]);
l.sendMessage(val[0],code);
}
} else
{
NotificationManager l=NotificationManager.getInstance();
for (String b:notification)
{
String val[]=b.split(",");
int code=Integer.parseInt(val[1]);
l.sendMessage(val[0],code);
}
}
}
NotificationManager.java
import java.util.HashMap;
import java.util.Map;
static {
messages.put(100,"Arrived at destination");
messages.put(101,"Attempted delivery");
messages.put(102,"Awaiting unloading at consignee");
messages.put(103,"Delayed en route to destination");
messages.put(104,"Delivered part short");
messages.put(105,"En route to destination");
messages.put(106,"En route to Hawaii");
messages.put(107,"Late but no possible delay notification sent");
messages.put(108,"Out for delivery");
private NotificationManager() {
NotificationThread.java
import java.util.Iterator;
import java.util.List;
public class NotificationThread //fill your code here!!!
{
//fill your attributes here!!!