@Override
	protected Object doInBackground() throws Exception {
		
		System.out.println("================ Running thread =============");
		String prevString = "";
		
		while(true){
		
			Thread.sleep(10000);
			
			String urlString = "http://localhost:8080/WebServer/UserListFetcher";
	        URL url;
	        String jsonString = "";
	        UsersList users = new UsersList(null);
	        
	        
	        try {
				url = new URL(urlString);
				URLConnection conn = url.openConnection();
				conn.connect();
				
				ObjectInputStream o = new ObjectInputStream(conn.getInputStream());
				jsonString = (String) o.readObject();
				ObjectMapper mapper = new ObjectMapper();
				
				users = mapper.readValue(jsonString, UsersList.class);
				System.out.println("Fetched users" + jsonString);
				
				if(!prevString.equalsIgnoreCase(jsonString)){
					prevString = jsonString;
					
					userPanel.removeAll();
					UserListUtils userListUtils = new UserListUtils();
					
					userListUtils.removeAllUsers();
					
					for (User usr : users.users) {
			        	System.out.println("Main " + usr.getIP() + " " + usr.getName() + " " + usr.getPORT() + " " + usr.getFiles());
			        	userListUtils.addToUserList(usr);
			        	for (String files : usr.getFiles()) {
			        		FileModel f = new FileModel (files, usr, currentUser);
			        		FileListUtils fl = new FileListUtils(usr.getHistoryFileListModel());
			        		fl.addToFileList(f);
			        	}
			        }
					
					userPanel.add(usersList);
					
					userPanel.repaint();
					
					//update user listJPanel
				}
				
			} catch (Exception e) {
				System.err.println("error");
				e.printStackTrace();
			}
		}
	}