Skip to content
This repository was archived by the owner on Jul 13, 2018. It is now read-only.

Refactor DfsBlockCache and make it pluggable#1

Open
jiahuijiang wants to merge 3 commits intomasterfrom
jj/new-cache
Open

Refactor DfsBlockCache and make it pluggable#1
jiahuijiang wants to merge 3 commits intomasterfrom
jj/new-cache

Conversation

@jiahuijiang
Copy link
Owner

  • Made a DfsBlockCache abstract class
  • Renamed the original DfsBlockCache into DefaultDfsBlockCache
    and refactor to make it extend DfsBlockCache

- Made a `DfsBlockCache` abstract class
- Renamed the original `DfsBlockCache` into `DefaultDfsBlockCache`
  and refactor to make it extend `DfsBlockCache`
}
public static void resetCache(DfsBlockCache newCache) {
DfsBlockCache oldCache = cache;
cache = newCache;

Choose a reason for hiding this comment

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

probably want to make the cache an AtomicReference to do DfsBlockCache oldCache = cache.getAndSet(newCache); as there's currently a possible race condition here for multiple concurrent calls.

nit: might want to name method as set or setInstance

@gracew
Copy link

gracew commented Feb 17, 2017

note (that you probably know already, but just in case): when you want to merge this into jgit you need to do it via gerrit, not a github PR

@gracew
Copy link

gracew commented Feb 17, 2017

although meanwhile we can depend on a forked version built from this repo which is good!

}
}
static {
cache = new AtomicReference<>();

Choose a reason for hiding this comment

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

nit: maybe we should do this in the same line as the declaration?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants