public Worker getAvailableByActivityAndStatus ( int activityId , String status ) {
		
		Connection con = null;
		PreparedStatement statement = null;
		ResultSet rs = null;
		Worker worker = null;
		
		try {
			
			con = ConnectionManager.getConnection();
			
			String searchQuery = "SELECT workers.id, workers.status, workers.local_ip, workers.public_ip, workers.instance_id, workers.is_manager, workers.last_time_worked, workers.last_time_alive FROM workers, installations "
					+ "WHERE workers.id = installations.workerId AND installations.activityId = ? "
					+ "AND installations.status = 'installed'"
					+ "AND workers.status = ?";
			
			statement = con.prepareStatement(searchQuery);
			statement.setInt(1, activityId );
			statement.setString(2, status );
			
			rs = statement.executeQuery();
			
			while (rs.next()) {
				
				worker = new Worker();
				worker.setId( rs.getInt("id") );
				worker.setStatus( rs.getString("status") );
				worker.setLocalIp( rs.getString("local_ip") );
				worker.setPublicIp( rs.getString("public_ip") );
				worker.setInstanceId( rs.getString("instance_id") );
				worker.setManager( rs.getBoolean("is_manager") );
				worker.setLastTimeWorked( rs.getTimestamp("last_time_worked"));
				worker.setLastTimeAlive( rs.getTimestamp("last_time_alive"));
			}
			
		} catch (SQLException e) {
			e.printStackTrace();
			error = e.toString();
		}
		
		finally {
			if (rs != null)	{
			    try {
			     	rs.close();
			    } catch (Exception e) { System.err.println(e); }
			        rs = null;
			    }
		     
		     if (statement != null) {
		        try {
		        	statement.close();
		        } catch (Exception e) { System.err.println(e); }
		        	statement = null;
		        }
		
		     if (con != null) {
		        try {
		        	con.close();
		        } catch (Exception e) { System.err.println(e); }
		
		        con = null;
		     }
		}
		return worker;
	}