all ready finished kindle android app just need some code modification
$250-750 USD
취소됨
게시됨 11년 이상 전
$250-750 USD
제출할때 지불됩니다
Need to create a
Matcher Thread
Your Matcher thread should have a constructor that takes in 4 parameters public Matcher(DataFeeder f, long sleep, String matchingType, Channel channel){}:
'f', An implementation of DataFeeder interface.
'sleep', the sleep interval for the thread in milli seconds.
'matchingType', The type of matching to be performed.
'channel', The channel you have defined and initialized in the server. By using this, you can send messages to the responder and requester after each assignment.
Every time the matcher thread wakes up, it calls methods in DataFeeder interface to assign requests to a response. If it cannot find a match, it will just go back to sleep. The thread keeps on matching as many requests and responses as possible. Once it has matched all possibilities, it goes back to sleep. You have to implement two kinds of matchers, FCFS in which the first request is matched with the first response and MostRecent in which the last request is matched with the last response first.
mplementation
Server
You should modify your Server class from Project 6. The server should start a Matcher thread(see below) when it starts. Also you should modify your server logic in such a way that when messages are received, it is added to the request or response list and no assignment or matching happens.
Your server should also take in two extra parameters from the command line - matching type and sleep time. This means now your server takes in 3 command line parameters java Server port matchtype sleep.
eg: java Server 1234 FCFS 1000 means start the server at port 1234, with matching type FCFS and a sleep time of 1000 milli seconds.
DataFeeder Interface
Create a new interface DataFeeder with the code given below in the appropriate folder. Note the package structure and make sure your folder structure matches it.