@Override
	public void run() {
		DistributedBackupSystem.fManager.backupFile(filename, replicationDegree);
		BackupFile file = DistributedBackupSystem.fManager.getFileByName(filename);
		if(file != null) {
			for(Packet p : messages) {
				if(p.getPacketType().equals("DELETE") && Packet.bytesToHex(p.getFileID()).equals(Packet.bytesToHex(file.getFileID()))) {
                    try {
                        DistributedBackupSystem.tManager.executeTask(TaskManager.TaskTypes.DELETE, file.getFileID(), 0).get();
                        DistributedBackupSystem.fManager.getFiles().remove(DistributedBackupSystem.fManager.getFileByName(filename));
                        DistributedBackupSystem.fManager.updateLog();
                    } catch (Exception e) {e.printStackTrace();};
                }
			}
		}
	}