public ServerHeartbeatManager() {
		logger.info("Loading ServerHeartbeatManager...");
		config = Config.getInstance();
		serverId = config.getInt("server.id");
		
		// create server record if it doesn't exist
		Connection dbConnection = DbHelper.getMainDb().getConnection();
		if (dbConnection == null) {
			throw(new RuntimeException("Error connecting to database when starting server heartbeat manager."));
		}
		
		PreparedStatement s = null;
		try {
			s = dbConnection.prepareStatement("SELECT count(*) AS count FROM processing_servers WHERE id=?");
			s.setInt(1, serverId);
			ResultSet r = s.executeQuery();
			r.next();
			int count = r.getInt("count");
			s.close();
			if (count == 0) {
				// server record doesn't exist
				logger.info("No entry for this server in the database. Creating one...");
				try {
					s = dbConnection.prepareStatement("INSERT INTO processing_servers SET id=?, heartbeat=?");
					Timestamp currentTimestamp = new Timestamp(System.currentTimeMillis());
					s.setInt(1, serverId);
					s.setTimestamp(2, currentTimestamp);
					if (s.executeUpdate() != 1) {
						s.close();
						throw(new RuntimeException("Error when trying to create entry for server in database."));
					}
					s.close();
				} catch (SQLException e) {
					e.printStackTrace();
					throw(new RuntimeException("Error when trying to create entry for server in database."));
				}
				logger.info("Created entry for this server in the database.");
			}
			dbConnection.close();
		} catch (SQLException e1) {
			e1.printStackTrace();
			throw(new RuntimeException("Error when trying to start server heartbeat manager."));
		}
		
		timer = new Timer(false);
		updateInterval = config.getInt("general.heartbeatInterval")*1000;
		timer.scheduleAtFixedRate(new Task(), 0, updateInterval);
		logger.info("Loaded ServerHeartbeatManager.");
	}