Date endDate = history.getEnd_date();
String username = usernameMap.get(history.getUser_id());
// If there are active users, list the top N not-ended connections
// as active (best guess)
MySQLConnectionRecord connectionRecord;
if (user_count > 0 && endDate == null) {
connectionRecord = new MySQLConnectionRecord(startDate, endDate, username, true);
user_count--;
}
// If no active users, or end date is recorded, connection is not
// active.
else
connectionRecord = new MySQLConnectionRecord(startDate, endDate, username, false);
connectionRecords.add(connectionRecord);
}