activeFeedViews.remove(manifestation);
}
public SynchronizationControl synchronizeTime(final long syncTime) {
final Set<FeedView> syncedManifestations = new HashSet<FeedView>();
SynchronizationControl sc = new SynchronizationControl() {
@Override
public void update(long syncTime) {
/* Assume the "time" is uniform across all providers, this is a limitation that needs to
* removed when feeds (non ISP) are added. One way to do this is to pass the time
* service along with the time to get offsets between the various time services. For
* example, TimeServiceA - 4, TimeServiceB - 2, then if time 3 was passed along with
* TimeServiceA then the offset to TimeServiceB would be (2 - 4) = -2 + time to get the
* time from TimeServiceB.
*/
Map<FeedProvider, Long[]> times = new HashMap<FeedProvider,Long[]>();
for (FeedView manifestation:activeFeedViews) {
for (FeedProvider provider:manifestation.getVisibleFeedProviders()) {
times.put(provider, new Long[]{syncTime-2000, syncTime});
}
}
FeedCycleRenderer renderer = createSyncWorker(syncTime, times, activeFeedViews, syncedManifestations);
try {
renderer.execute();
} catch (Exception e) {
LOGGER.error(e);
}
}
@Override
public void synchronizationDone() {
activeSyncControl.set(null);
for(FeedView m : syncedManifestations) {
m.synchronizationDone();
}
}
};
if (!activeSyncControl.compareAndSet(null, sc)) {
return null;
}
/* Assume the "time" is uniform across all providers, this is a limitation that needs to
* removed when feeds (non ISP) are added. One way to do this is to pass the time
* service along with the time to get offsets between the various time services. For
* example, TimeServiceA - 4, TimeServiceB - 2, then if time 3 was passed along with
* TimeServiceA then the offset to TimeServiceB would be (2 - 4) = -2 + time to get the
* time from TimeServiceB.
*/
Map<FeedProvider, Long[]> times = new HashMap<FeedProvider,Long[]>();
for (FeedView manifestation:activeFeedViews) {
for (FeedProvider provider:manifestation.getVisibleFeedProviders()) {
times.put(provider, new Long[]{syncTime-2000, syncTime});
}
}
FeedCycleRenderer renderer = createSyncWorker(syncTime, times, activeFeedViews, syncedManifestations);
try {
renderer.execute();
} catch (Exception e) {
LOGGER.error(e);
sc.synchronizationDone();
sc = null;
}
return sc;
}