break;
} else {
try {
Thread.sleep(remainingInterval);
} catch (InterruptedException e) {
throw new OsmosisRuntimeException("Unable to sleep until next replication iteration.", e);
}
}
}
// Wait until either data becomes available or the maximum interval is reached.
while (true) {
// Update our view of the current database transaction state.
obtainNewSnapshot(state);
// Continue onto next step if data is available.
if (state.getTxnMaxQueried() != state.getTxnMax() || state.getTxnReady().size() > 0) {
break;
}
systemTimestamp = systemTimeLoader.getSystemTime();
if (LOG.isLoggable(Level.FINER)) {
LOG.finer("Loaded system time " + systemTimestamp + " from the database.");
}
// Continue onto next step if we've reached the maximum interval or
// if our remaining interval exceeds the maximum (clock skew).
long remainingInterval = state.getTimestamp().getTime() + maxInterval - systemTimestamp.getTime();
if (remainingInterval <= 0 || remainingInterval > maxInterval) {
break;
} else {
long sleepInterval = remainingInterval;
if (sleepInterval > minInterval) {
sleepInterval = minInterval;
}
try {
Thread.sleep(sleepInterval);
} catch (InterruptedException e) {
throw new OsmosisRuntimeException("Unable to sleep until data becomes available.", e);
}
}
}
LOG.fine("Processing replication sequence.");