Skip to content

Encapsulate scheduling in an inner class #111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 8, 2018

Conversation

gsoltis
Copy link
Contributor

@gsoltis gsoltis commented Nov 3, 2018

Experimental. Try encapsulating lru scheduling in its own class.

@gsoltis
Copy link
Contributor Author

gsoltis commented Nov 3, 2018

/test smoke-tests-release

} else {
persistence = MemoryPersistence.createEagerGcMemoryPersistence();
}

persistence.start();
localStore = new LocalStore(persistence, user);
if (gc != null) {
lruScheduler = gc.new Scheduler(asyncQueue, localStore);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really strange to me. Can this be new gc.Scheduler()? I am not sure if that would work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can't, but I wrapped it in a static method so I guess it's a little less weird?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Er, not static. Because it's not a static class. But a helper method.

@@ -99,6 +107,43 @@ public int getDocumentsRemoved() {
}
}

public class Scheduler {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this PR! While there is some special-casing in FirestoreClient with this PR, I don't think it's necessarily more than before, and some of it might even go away if we always run LRU (for Memory persistence for example). The encapsulation in Scheduler is really nice and hides all implementation details. Thanks.

@gsoltis gsoltis merged commit ca8e8a9 into gsoltis/enable_lru Nov 8, 2018
@vkryachko vkryachko deleted the gsoltis/encapsulate_scheduling branch March 19, 2019 14:08
@firebase firebase locked and limited conversation to collaborators Oct 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes Override cla size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants