Skip to content

Commit

Permalink
Fix merge conflicts after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardehrenfried committed May 24, 2024
1 parent 7a52422 commit 3bc32bb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,15 @@ public class AbstractTimetableSnapshotSource implements TimetableSnapshotProvide
protected final TimetableSnapshot buffer = new TimetableSnapshot();

/**
* The last committed snapshot that was handed off to a routing thread. This snapshot may be given
* to more than one routing thread if the maximum snapshot frequency is exceeded.
* The working copy of the timetable snapshot. Should not be visible to routing threads. Should
* only be modified by a thread that holds a lock on {@link #bufferLock}. All public methods that
* might modify this buffer will correctly acquire the lock. By design, only one thread should
* ever be writing to this buffer.
* TODO RT_AB: research and document why this lock is needed since only one thread should ever be
* writing to this buffer. One possible reason may be a need to suspend writes while indexing
* and swapping out the buffer. But the original idea was to make a new copy of the buffer
* before re-indexing it. While refactoring or rewriting parts of this system, we could throw
* an exception if a writing section is entered by more than one thread.
*/
private volatile TimetableSnapshot snapshot = null;

Expand All @@ -41,7 +48,10 @@ public class AbstractTimetableSnapshotSource implements TimetableSnapshotProvide
*/
private final CountdownTimer snapshotFrequencyThrottle;

/** Should expired real-time data be purged from the graph. */
/**
* Should expired real-time data be purged from the graph.
* TODO RT_AB: Clarify exactly what "purge" means and in what circumstances would one turn it off.
*/
private final boolean purgeExpiredData;
/**
* We inject a provider to retrieve the current service-date(now). This enables us to unit-test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,34 +80,12 @@ public class TimetableSnapshotSource extends AbstractTimetableSnapshotSource {
*/
private static final long MAX_ARRIVAL_DEPARTURE_TIME = 48 * 60 * 60;

/**
* The working copy of the timetable snapshot. Should not be visible to routing threads. Should
* only be modified by a thread that holds a lock on {@link #bufferLock}. All public methods that
* might modify this buffer will correctly acquire the lock. By design, only one thread should
* ever be writing to this buffer.
* TODO RT_AB: research and document why this lock is needed since only one thread should ever be
* writing to this buffer. One possible reason may be a need to suspend writes while indexing
* and swapping out the buffer. But the original idea was to make a new copy of the buffer
* before re-indexing it. While refactoring or rewriting parts of this system, we could throw
* an exception if a writing section is entered by more than one thread.
*/
private final TimetableSnapshot buffer = new TimetableSnapshot();

/** Lock to indicate that buffer is in use. */
private final ReentrantLock bufferLock = new ReentrantLock(true);

/** A synchronized cache of trip patterns added to the graph due to GTFS-realtime messages. */
private final TripPatternCache tripPatternCache = new TripPatternCache();

private final ZoneId timeZone;
private final TransitEditorService transitService;

/**
* Should expired real-time data be purged from the graph.
* TODO RT_AB: Clarify exactly what "purge" means and in what circumstances would one turn it off.
*/
private final boolean purgeExpiredData;

private final Deduplicator deduplicator;

private final Map<FeedScopedId, Integer> serviceCodes;
Expand Down

0 comments on commit 3bc32bb

Please sign in to comment.