@@ -0,0 +1,1248 @@
+package Tracker;%0A%0Aimport java.sql.Time;%0Aimport java.util.ArrayList;%0Aimport java.util.Timer;%0Aimport java.util.concurrent.locks.ReentrantLock;%0A%0A/**%0A * %0A * @author Pawel%0A *%0A */%0A%0A/**%0A Tracker will check torrent files usage and make statistics from it,%0A such as how many peers are downloading file, how much of it is being downloaded and so on.%0A */%0A%0Apublic class Tracker%0A%7B%0A%09// timer is needed for calculating operations times%0A%09Timer timer;%0A%09Time time;%0A%09// list of possible tracker states%0A%09public static final String EVENT%5B%5D =%0A%09%09%7B%0A%09%09    %22Started%22, %22Stopped%22, %22Completed%22, %22Update%22%0A%09%09%7D;%0A%09// how long tracker should wait for response%0A%09public int interval = 5 * 60;%0A%09// this lock will prevent from unnecessary changes of tracker status%0A%09private ReentrantLock trackerLock = new ReentrantLock();%0A%09// list of peers%0A%09ArrayList%3CPeer%3E peers;%0A%09public int fileID, userID;%0A%09public String url;%0A%09public InfoHash infoHash;%0A%09%0A%09public Tracker(int fileID)%0A%09%7B%0A%09%09this.fileID = fileID;%0A%09%09// infoHash value should be given here%0A%09%09this.userID = time.getMinutes() * time.getSeconds();%0A%09%09this.peers = new ArrayList%3CPeer%3E(fileID);%0A%09%7D%0A%09%0A%09// managing tracker's lock%0A%09%0A%09public void lock()%0A%09%7B%0A%09%09this.trackerLock.lock();%0A%09%7D%0A%09%0A%09public void unlock()%0A%09%7B%0A%09%09this.trackerLock.unlock();%0A%09%7D%0A%7D%0A

Create Tracker.java