mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
Return old dirtyEntries as deprecated to keep compatibility
This commit is contained in:
@@ -130,6 +130,15 @@ public interface Replica extends Closeable {
|
||||
*/
|
||||
boolean nextEntry(@NotNull final Callback callback, final int chronicleId);
|
||||
|
||||
/**
|
||||
* Synchronous version which is kept for binary API compatibility.
|
||||
*
|
||||
* @deprecated see {@link #dirtyEntries(long, EventLoop)}
|
||||
* @param fromTimeStamp the timestamp from which all entries should be dirty
|
||||
*/
|
||||
@Deprecated(/* to be removed in x.22 */)
|
||||
void dirtyEntries(long fromTimeStamp);
|
||||
|
||||
/**
|
||||
* Dirties all entries with a modification time equal to {@code fromTimeStamp} or newer and
|
||||
* origin identifier equal to the current node identifier. It means all these entries will
|
||||
|
||||
@@ -992,8 +992,12 @@ public class ReplicatedChronicleMap<K, V, R> extends VanillaChronicleMap<K, V, R
|
||||
|
||||
@Override
|
||||
public boolean action() throws InvalidEventHandlerException {
|
||||
if (segmentIndex >= actualSegments)
|
||||
workCompleted();
|
||||
if (segmentIndex >= actualSegments) {
|
||||
if (iterationContext != null)
|
||||
iterationContext.close();
|
||||
|
||||
throw new InvalidEventHandlerException("background work is done, removing the handler");
|
||||
}
|
||||
|
||||
if (!segmentPredicate.test(segmentIndex)) {
|
||||
segmentIndex++;
|
||||
@@ -1033,7 +1037,10 @@ public class ReplicatedChronicleMap<K, V, R> extends VanillaChronicleMap<K, V, R
|
||||
}
|
||||
});
|
||||
} catch (ChronicleHashClosedException e) {
|
||||
workCompleted();
|
||||
if (iterationContext != null)
|
||||
iterationContext.close();
|
||||
|
||||
throw new InvalidEventHandlerException(e);
|
||||
}
|
||||
|
||||
segmentIndex++;
|
||||
@@ -1041,14 +1048,24 @@ public class ReplicatedChronicleMap<K, V, R> extends VanillaChronicleMap<K, V, R
|
||||
return true;
|
||||
}
|
||||
|
||||
private void workCompleted() throws InvalidEventHandlerException {
|
||||
if (iterationContext != null)
|
||||
iterationContext.close();
|
||||
|
||||
throw new InvalidEventHandlerException("removes the handler");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated(/* to be removed in x.22 */)
|
||||
public void dirtyEntries(long fromTimeStamp) {
|
||||
throwExceptionIfClosed();
|
||||
|
||||
final DirtyEntriesHandler syncHandler = new DirtyEntriesHandler(segment -> true, fromTimeStamp);
|
||||
|
||||
try {
|
||||
for (int i = 0; i < actualSegments; i++)
|
||||
syncHandler.action();
|
||||
}
|
||||
catch (InvalidEventHandlerException e) {
|
||||
if (e.getCause() instanceof ChronicleHashClosedException)
|
||||
throw (ChronicleHashClosedException)e.getCause();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dirtyEntries(long fromTimeStamp, @NotNull EventLoop eventLoop) {
|
||||
|
||||
Reference in New Issue
Block a user